guardrail-dev / guardrail

Principled code generation from OpenAPI specifications
https://guardrail.dev
MIT License
526 stars 133 forks source link

Which OpenAPI version(s) is officially supported? #1647

Open sammy-da opened 1 year ago

sammy-da commented 1 year ago

I can't find the openapi version guardrail is targeting in the docs. (I suggest displaying this info on the docs front page, or similar)

is version 3.1.0 supported?

blast-hardcheese commented 1 year ago

I can't find the openapi version guardrail is targeting in the docs.

We support the versions of swagger and openapi that are recognized by the underlying parser, we have no direct control over that ourselves.

is version 3.1.0 supported?

Possibly, but even if the feature you're looking for has been added to the parser, someone would need to add that feature to guardrail itself.

The goal of this project is to have more consistent codegen based on ASTs, but that doesn't give us anything for free from the openapi-codegen libraries.

Does this answer your question? What was it that you were looking for? Did you try something and find it not working as you expected?

sammy-da commented 1 year ago

Does this answer your question?

It kinda does, thanks.

What was it that you were looking for?

I'm trying to upgrade an openapi 3.0 doc for an API to 3.1, because i wanted to make use of a new feature: https://github.com/OAI/OpenAPI-Specification/issues/2407

Did you try something and find it not working as you expected?

My existing 3.0 doc works fine with guardrail, but when i tried to bump to 3.1, code-generation is failing. (i was expecting it to work as the only change i made is the openapi version bump) I guess i'll submit a separate issue for that though.

sammy-da commented 1 year ago

Did you try something and find it not working as you expected?

My existing 3.0 doc works fine with guardrail, but when i tried to bump to 3.1, code-generation is failing. (i was expecting it to work as the only change i made is the openapi version bump) I guess i'll submit a separate issue for that though.

But in case you're wondering:

Error:Unknown type for the following structure (No type definition, class: io.swagger.v3.oas.models.media.JsonSchema, .components.schemas.AccountToken):
  Tracker(class JsonSchema {
      class Schema {
          type: [string]
          format: jwt
          description: A JWT access token for your account.
      }
  }, Vector(.components, .schemas, .AccountToken))

which corresponds to this in the doc:

{
   "components": {
      "schemas": {
         "AccountToken": {
            "description": "A JWT access token for your account.",
            "format": "jwt",
            "type": "string",
            "x-scala-type": "String"
         }
      }
   }
}

Built using the latest version of the sbt plugin (0.75.1)