christianhelle / refitter

Refit Client API Generator for OpenAPI
https://refitter.github.io
MIT License
157 stars 36 forks source link

Support for OpenAPI version 3.1.0 #328

Closed rmunson8 closed 4 months ago

rmunson8 commented 4 months ago

When running against an openAPI json with version 3.1.0:

Refitter v0.9.7.0 Support key: whx1qwy Error: OpenAPI specification version '3.1.0' is not supported. Exception: Microsoft.OpenApi.Readers.Exceptions.OpenApiUnsupportedSpecVersionException Stack Trace: at Microsoft.OpenApi.Readers.ParsingContext.Parse(YamlDocument yamlDocument) at Microsoft.OpenApi.Readers.OpenApiYamlDocumentReader.ReadAsync(YamlDocument input, CancellationToken cancellationToken) at Microsoft.OpenApi.Readers.OpenApiTextReaderReader.ReadAsync(TextReader input, CancellationToken cancellationToken) at Microsoft.OpenApi.Readers.OpenApiStreamReader.ReadAsync(Stream input, CancellationToken cancellationToken) at Microsoft.OpenApi.Readers.OpenApiMultiFileReader.Read(String openApiFile, CancellationToken cancellationToken) in /home/runner/work/oasreader/oasreader/src/OasReader/OpenApiMultiFileReader.cs:line 21 at Refitter.Validation.OpenApiValidator.Validate(String openApiFile) in //src/Refitter/Validation/OpenApiValidator.cs:line 13 at Refitter.GenerateCommand.ValidateOpenApiSpec(String openApiPath) in //src/Refitter/GenerateCommand.cs:line 144 at Refitter.GenerateCommand.ExecuteAsync(CommandContext context, Settings settings) in /_/src/Refitter/GenerateCommand.cs:line 72

christianhelle commented 4 months ago

@rmunson8 Have you tried using the --skip-validation option?

Refitter uses the Microsoft OpenAPI.NET library to validate the OAS document and that library doesn't officially support OAS v3.1.0, that said, if the OAS document that you are working with doesn't use much v3.1.0 specific features, then it might work...

rmunson8 commented 4 months ago

Thank you. I ran with --skip-validation and it ran successfully. Likely weren't using any v3.1.0 specific features.