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

Allow OpenAPI Schema object #324

Open
eduardomourar opened this issue Jul 15, 2021 · 1 comment
Open

Allow OpenAPI Schema object #324

eduardomourar opened this issue Jul 15, 2021 · 1 comment

Comments

@eduardomourar
Copy link
Contributor

eduardomourar commented Jul 15, 2021

Expected Behaviour

When defining a schema object (which is an extended subset of the JSON Schema Specification) in the context of a OpenAPI document, a few keywords might have a different meaning than in the standard JSON Schema specification (details here). I would like to have an option to signal that my schema actually follows the OpenAPI definition at least for keywords such as readOnly and writeOnly. Also, it would be nice to have additional keywords such as nullable and externalDocs be taken into account while rendering the Markdown file.

Actual Behaviour

Keywords such as readOnly and writeOnly can only follow the definition specified in the JSON Schema draft 2019-09. If a definition would look like this:

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://json-schema.org/draft/2019-09/output/schema",
  "description": "A sample schema",
  "title": "Sample",
  "properties": {
    "Id": {
      "type": "string",
      "readOnly": true
    }
  }
}

It would give the following output file:

Screenshot 2021-07-16 at 00 09 19

Even though, for this schema readOnly means:

it MAY be sent as part of a response but SHOULD NOT be sent as part of the request.

Therefore, the property being marked as Optional (as well as the text in the Access Restrictions section) gives the wrong impression that the API actually allows it to be passed by the user.

Reproduce Scenario

Steps to Reproduce

Platform and Version

MacOS
jsonschema2md v6.1.0

Sample Code that illustrates the problem

Logs taken while reproducing problem

@trieloff
Copy link
Collaborator

Makes sense. Feel free to create a PR.

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

2 participants