OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
28.82k stars 9.07k forks source link

Use TypeSchema as alternative schema #2839

Closed chriskapp closed 5 months ago

chriskapp commented 2 years ago

Hi,

we would like to use TypeSchema as an alternative schema at an OpenAPI specification. TypeSchema is a JSON format to describe data models.

To describe a little bit our background: We are currently working on a project where we automatically generate client SDK code based on an OpenAPI specification. This means our users provides us an OpenAPI specification and we automatically generate the client code, commit the code to a repository, generate a changelog and also tag a version. Each time the user provides a new specification we can automatically detect the changes according to semver. We are of course aware that there are code generation tools available but if you look closely they all have problems regarding code generation because of the highly recursive and flexbile nature of JsonSchema.

To solve this we have build TypeSchema. Currently we have wrote a converter which transforms a JsonSchema to a TypeSchema but it would be much greater if we could say to our users that they can use TypeSchema directly at the OpenAPI specification.

--

We have found the schema type registry at: https://spec.openapis.org/registry/alternative-schema/

but it looks like the "alternativeSchemas" keyword is not available at the current specification, is this idea regarding alternative schemas still in active use or is it abandoned?

Besides the alternative schema registry there is also the "jsonSchemaDialect" property. We could use this property to specify that we use TypeSchema as schema specification but it looks like it is targeted to JsonSchema?

So please let me know your thoughts and whether there is currently a clean way to use a different schema language at an OpenAPI specification.

handrews commented 5 months ago

We are considering schema modularity in Moonwalk, and I added TypeSchema to one of the discussions over there:

I'm going to close this here as we're extremely unlikely to add alternative schemas to 3.x given the tooling complexity it would introduce.