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

JSON schema's "allOf" results in no declared properties of a RAML type #24

Open
deiteris opened this issue Jun 26, 2021 · 1 comment
Open

Comments

@deiteris
Copy link
Contributor

deiteris commented Jun 26, 2021

When a JSON schema object combines two properties using allOf, the API console doesn't show any declared properties of the type.

The following RAML reproduces the issue:

#%RAML 1.0

title: Example API
version: v1
mediaType:
  - application/json

types:
  allOfSchema: |
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "object",
      "allOf": [
        {
          "properties": {
            "original": {
              "description": "Original property",
              "type": "string"
            }
          }
        },
        {
          "properties": {
            "extension": {
              "description": "Extension property",
              "type": "string"
            }
          }
        }
      ]
    }


/example:
  get:
    body:
      type: allOfSchema
      example: |
        {
          "extension": ""
        }

And results in the following graph: https://pastebin.com/Eysrm4S1

I assume this happens because shacl:and is not taken into account, while shacl:property is empty in this case.

{
    ...
    "doc:declares": [
      {
        "@id": "#1",
        "@type": [
          "shacl:NodeShape",
          "raml-shapes:AnyShape",
          "shacl:Shape",
          "raml-shapes:Shape",
          "doc:DomainElement"
        ],
        "shacl:closed": [
          {
            "@value": false
          }
        ],
        "shacl:property": [],
        "shacl:name": [
          {
            "@value": "allOfSchema"
          }
        ],
        "shacl:and": [
          {
            "@id": "#2",
            "@type": [
              "shacl:NodeShape",
              "raml-shapes:AnyShape",
              "shacl:Shape",
              "raml-shapes:Shape",
              "doc:DomainElement"
            ],
           ...
          }
        ]
      }
    ]
}
@deiteris
Copy link
Contributor Author

deiteris commented Jun 26, 2021

I was able to fix this for my own purposes with the following changes: deiteris@c2f095d

I can either create a PR if these changes are sufficient, or it may give you a better idea of how it will be better to be fixed.

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