openservicebrokerapi / servicebroker

Open Service Broker API Specification
https://openservicebrokerapi.org/
Apache License 2.0
1.19k stars 436 forks source link

OSB OpenAPI Spec Fails to Generate #712

Closed kabronkline closed 4 years ago

kabronkline commented 4 years ago

What is the problem? Latest version of OpenAPI Generator Maven plugin fails to parse v2.15 of the OSB specification which results in failure of the code generator.

[ERROR] 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: 1, Warning count: 3 Errors: -Could not find components/schemas/# in contents of http://json-schema.org/draft-04/schema

Using OpenAPI spec yaml from: https://raw.githubusercontent.com/openservicebrokerapi/servicebroker/v2.15/openapi.yaml

With the following plugin:

org.openapitools openapi-generator-maven-plugin 4.3.1

Who does this affect? Developers attempting to generate spec compliant OSB API stubs.

Do you have any proposed solutions? Not at this time, still investigating root cause.

Additional context None

Samze commented 4 years ago

Hi @kabronkline, thanks for the issue. Do you get the same issue against master?

rsampaio commented 4 years ago

@kabronkline there is a long-standing issue with OpenAPI 3.0 that breaks validation of OpenAPI specs that reference json-schema https://github.com/p1c2u/openapi-core/issues/90 and if you disable spec validation with the option <skipValidateSpec>true</skipValidateSpec> it should succeed with functional code for both server and client depending on the language you are using.

I was able to successfully generate a java client with openapi-generator generate -i openapi.yaml -g java --skip-validate-spec -o ../java-osb-api, please re-open if you have issues.