Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for main properties is not rendered if the schema contains referenced composition part ('allOf') #171

Open
pspot2 opened this issue Oct 27, 2022 · 0 comments

Comments

@pspot2
Copy link

pspot2 commented Oct 27, 2022

Consider the following two schemas (schema_test1.json references schema_test2.json):

schema_test1.json
{
    "$id": "file:///home/eub-user/schema_test1.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "root",
    "description": "Root-level schema",
    "type": "object",
    "required": [
        "test_property01",
        "test_property02"
    ],
    "properties": {
        "test_property01": {
            "description": "Test property 01",
            "type": "string",
            "pattern": "^[a-z]{2,}[-_a-z0-9]+$"
        },
        "test_property02": {
            "description": "Test property 02",
            "type": "integer"
        }
    },
    "allOf": [
        {
            "$ref": "schema_test2.json"
        }
    ]
}
schema_test2.json
{
    "$id": "schema_test2.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "Schema test 2",
    "description": "Test Y",
    "required": [
        "other_property_3"
    ],
    "properties": {
        "other_property_3": {
            "description": "Test other property 3",
            "type": "string"
        }
    }
}

The first schema defines two fixed properties: test_property01 and test_property02. It also attaches the second schema by the means of allOf composition. The second schema is not directly defined inside allOf, but rather referenced from a separate file.

Expectation: rendered document contains details for all 3 properties:

  • test_property01 (located in schema_test1.json)
  • test_property02 (located in schema_test1.json)
  • other_property_3 (located in schema_test2.json)

Actual result: a messed-up document:

  • First two properties are not mentioned in the property summary table
  • No details about the first two properties (they are only mentioned as required under The following properties are required section)
  • The third property is not flagged as defined in schema_test2.json in the overview table
Click to expand

root

Title: root

Type object
Additional properties Any type: allowed
Defined in

Description: Root-level schema

Property Pattern Type Deprecated Definition Title/Description
+ other_property_3 No string No - Test other property 3

The following properties are required

  • test_property01
  • test_property02

Required Property Schema test 2 > other_property_3

Type string

Description: Test other property 3


Generated using json-schema-for-humans on 2022-10-27 at 17:14:09 +0000

Note: the document is rendered correctly if the contents of schema_test2.json is provided directly inside the allOf block instead of being referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant