Open fenollp opened 6 years ago
I'd be OK with using ex_json_schema
for validations. As you say, it just needs to be possible to map swagger schemas to json schema.
It would be great if there was a mode: swagger
option in ex_json_schema, but if you want to get something working immediately we'd need to map it in open_api_spex.
The people over at OpenAPI and at JSON Schema want to converge their schema specs eventually. To me it makes more sense to do a conversion to (and from?) JSON Schema before validation.
In which module do you think this conversion step should go?
@moxley why is this labeled as wontfix
? Thanks.
@fenollp: The Won't Fix
label is only tentative, but requires further discussion to be sure. From what I understand, JSON Schema isn't compatible with Open API. Open API borrows much from JSON Schema, but it extends and modifies it. Here are some of the details of the differences: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schema-object. I don't think it's feasible to swap in a JSON Schema library.
By the way, we set up a private channel in the Elixir Slack for discussions. Would you be willing to join us there? You've already been added.
Looks like this can be achieved when OpenApi 3.1 is released. OpenAPI schemas will be a proper superset of the latest json schema draft 🎉
Any chance this library will be updated to OpenAPI 3.1?
Following on #23 (and my attempt at solving it: #42), I have been instead using the really good
ex_json_schema
.Here is the code I am using:
There needs to be a translation step first though, to rewrite
nullable: true
and such incompatibilities of OpenAPIV3 schemas with JSON Schema Draft-04.Would you be open to use
ex_json_schema
validators instead of the current ones in this lib? Where do you think this translation step should be: within this lib or withinex_json_schema
?Thanks