This pull request suggests to use the --skip-validation upon OpenApiUnsupportedSpecVersionException.
When OpenApiUnsupportedSpecVersionException is thrown, the user will be prompted to use the --skip-validation argument to bypass the validation process. In most cases, the code will still generate successfully, even though validation failed. However, this is no garantee
Additionally, the pull request includes some minor formatting improvements in the exception handling code.
The output of using a v3.1.0 spec is something like this:
Refitter v1.0.0.0
Support key: ptbddgt
Unsupported OpenAPI version: 3.1.0
Try using the --skip-validation argument.
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 C:\projects\christianhelle\refitter\src\Refitter\Validation\OpenApiValidator.cs:line 13
at Refitter.GenerateCommand.ValidateOpenApiSpec(String openApiPath) in C:\projects\christianhelle\refitter\src\Refitter\GenerateCommand.cs:line 155
at Refitter.GenerateCommand.ExecuteAsync(CommandContext context, Settings settings) in C:\projects\christianhelle\refitter\src\Refitter\GenerateCommand.cs:line 74
#############################################################################
# Consider reporting the problem if you are unable to resolve it yourself #
# https://github.com/christianhelle/refitter/issues #
#############################################################################
This pull request suggests to use the
--skip-validation
uponOpenApiUnsupportedSpecVersionException
.When
OpenApiUnsupportedSpecVersionException
is thrown, the user will be prompted to use the--skip-validation
argument to bypass the validation process. In most cases, the code will still generate successfully, even though validation failed. However, this is no garanteeAdditionally, the pull request includes some minor formatting improvements in the exception handling code.
The output of using a v3.1.0 spec is something like this: