Open chrisnappin opened 5 years ago
This is as designed, from the specification:
Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.
Theoretically, https://github.com/wework/json-schema-to-openapi-schema might be able to rewrite your JSON Schema file (as I see you're using the -j
option) in some way, and depending on how you're $ref
ing into it, but I suspect this is out of scope for speccy
itself.
Thanks for getting back to me.
Yes, we're trying to use speccy to convert a JSON schema to an Open API schema. I couldn't see any details on limitations in speccy in this area?
We'd like to have our schema files separate to our main openapi.yml (since the schema are used for other purposes) with a single $ref to each schema.
An example of the complex JSON schemas we're using is https://github.com/dvsa/mes-api-definitions/blob/develop/mes-journal-schema/schema-examiner-work-schedule.json. I'm not that familiar with JSON schema but I can't see how we can structure repeating nested objects without putting them under a "definitions" section?
Do you have any advice on how we can use speccy schema conversion with complex schemas?
Hey @chrisnappin what approach did you end up taking? I am doing something similar. Need to validate an OpenAPI spec that is in the request body.
We had to abandon any use of open api! This was a complete show stopper for us I'm afraid.
Ah darn. Ok, thanks for responding.
Speccy should be migrating JSON schema "definitions"
into the spec's "components/schemas"
object, right?
When using a JSON Schema with "definitions" blocks, speccy returns the error
Schema object cannot have additionalProperty: definitions
.For example, consider an OpenAPI v3.0.2 definition in yaml format with the following reference to a JSON schema:
Then a really simple JSON schema as follows:
Then invoking speccy via an npm script within my
package.json
:When running the linter:
Context
I'm attempting to add OpenAPI definitions to en existing project with JSON Schema already used for other purposes (e.g. generating Typescript interface types)
Your environment