paytrail / api-documentation

Paytrail Payment API documentation
MIT License
6 stars 11 forks source link

OpenApi specification does not work unless --skip-validate-spec is used #14

Closed gusthavosouza closed 2 years ago

gusthavosouza commented 2 years ago

Describe the bug

Code generation using OpenApi only works if --skip-validate-spec argument is used.

Current using: https://docs.paytrail.com/paytrail-api.yaml

OpenApi Generator:

https://openapi-generator.tech/#try

Error

[main] INFO o.o.c.config.CodegenConfigurator - VERBOSE MODE: ON. Additional debug options are injected [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen [debugModels] prints models passed to the template engine [debugOperations] prints operations passed to the template engine [debugSupportingFiles] prints additional data passed to the template engine [main] INFO o.o.codegen.utils.ModelUtils - [deprecated] inheritance without use of 'discriminator.propertyName' has been deprecated in the 5.x release. Composed schema name: null. Title: null [main] INFO o.o.codegen.utils.ModelUtils - [deprecated] inheritance without use of 'discriminator.propertyName' has been deprecated in the 5.x release. Composed schema name: null. Title: null Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI). | Error count: 2, Warning count: 0 Errors: -attribute paths.'/payments/{transactionId}/token/commit'. Declared path parameter transactionId needs to be defined as a path parameter in path or operation level -attribute paths.'/payments/{transactionId}/token/revert'. Declared path parameter transactionId needs to be defined as a path parameter in path or operation level at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:541) at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:568) at org.openapitools.codegen.cmd.Generate.execute(Generate.java:424) at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32) at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

Second way of testing the errors:

Go to: https://editor.swagger.io/

Click on file -> Import URL

Paste: https://docs.paytrail.com/paytrail-api.yaml

Errors should be shown:

image
jfrojd-paytrail commented 2 years ago

Thank you for a the well documented issue, we will have a look and implement necessary fixes.