OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.81k stars 6.58k forks source link

[codegen] Unexpected behavior for remote YAML $ref #527

Closed markus-wa closed 6 years ago

markus-wa commented 6 years ago
Description
  1. Ref needs ./ for the filepath, not sure why (i.e. $ref: './model/lov.yaml#/Lov' instead of $ref: 'model/lov.yaml#/Lov')
  2. In referenced yamls, I had to do a remote reference to the current file (i.e. $ref: './lov.yaml#/LovEntry' instead of $ref: '#/LovEntry')

Note that this is on Windows, not sure if that could have something to do with it.

openapi-generator version

3.1.0

OpenAPI declaration file content or url

ref-is-strange.zip

Command line used for generation

java -jar openapi-generator-cli-3.1.0.jar generate -g jaxrs-cxf -i expected/lov-api.yaml

Fails to resove references:

[main] INFO  o.o.codegen.DefaultCodegen - Skipped overwriting pom.xml as the file already exists in C:\Temp\lov\.\\pom.xml
[main] INFO  o.o.codegen.DefaultCodegen - Skipped overwriting .openapi-generator-ignore as the file already exists in C:\Temp\lov\.\\.openapi-generato                                                                                                                         r-ignore
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] WARN  o.o.codegen.DefaultCodegen - Error obtaining the datatype from ref:model/lov.yaml#/Lov. Default to 'object'
[main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: model/lov.yaml#/Lov
[main] INFO  o.o.codegen.DefaultGenerator - Skipped generation of C:\Temp\lov\.\src\main\java\org\openapitools\api\impl\LovsApiServiceImpl.java due to                                                                                                                          rule in .openapi-generator-ignore
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\gen\java\org\openapitools\api\LovsApi.java
[main] INFO  o.o.codegen.DefaultGenerator - File exists. Skipped overwriting C:\Temp\lov\./src\test\java/org/openapitools/api\LovsApiTest.java
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\.openapi-generator\VERSION

java -jar ~/Downloads/openapi-generator-cli-3.1.0.jar generate -g jaxrs-cxf -i actual/lov-api.yaml

Works:

[main] INFO  o.o.c.ignore.CodegenIgnoreProcessor - No .openapi-generator-ignore file found.
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\gen\java\org\openapitools\model\Lov.java
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\gen\java\org\openapitools\model\LovEntry.java
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\main\java\org\openapitools\api\impl\LovsApiServiceImpl.java
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\gen\java\org\openapitools\api\LovsApi.java
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\src\test\java\org\openapitools\api\LovsApiTest.java
[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\pom.xml
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\.openapi-generator-ignore
[main] INFO  o.o.codegen.AbstractGenerator - writing file C:\Temp\lov\.\.openapi-generator\VERSION
Steps to reproduce

See CLI commands & attachment

Related issues/PRs

N/A

Suggest a fix/enhancement

Behave as expected, see attachment

jmini commented 6 years ago

This needs to be analyzed at Swagger-Parser level. Sample Java Snippet:

OpenAPIParser openApiParser = new OpenAPIParser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setFlatten(true);

OpenAPI openAPI = openApiParser.readLocation(inputSpec, null, options).getOpenAPI();
String string = Yaml.mapper().writerWithDefaultPrettyPrinter().writeValueAsString(openAPI);

System.out.println(string);

If you find something that is not working, please create an issue in Swagger-Parser.

Let me know if you need help.

markus-wa commented 6 years ago

Hmm, the output of the swagger parser seems correct to me.

Output from `expected/lov-api.yaml` ``` openapi: 3.0.0 info: title: WSG LOV license: name: UNLICENSED version: 1.0.0-DRAFT servers: - url: /wsg-lov/v1 paths: /lovs/{id}: get: tags: - lovs summary: get LOV by ID description: | Get list of values by LOV ID operationId: getLovById parameters: - name: id in: path required: true style: simple explode: false schema: type: integer format: int32 responses: 200: description: LOV found content: application/json: schema: $ref: '#/components/schemas/Lov' components: schemas: Lov: required: - id - name type: object properties: id: type: integer format: int32 name: type: string entries: type: array items: $ref: '#/LovEntry' LovEntry: required: - label - value type: object properties: value: type: integer format: int32 label: type: string label2: type: string ```


The version the generator is using looks good as well https://github.com/OpenAPITools/openapi-generator/blob/master/pom.xml#L1058 - I tested it with the same one

markus-wa commented 6 years ago

Turns out this happens when the parser receives a path that doesn't start with file://.

file:/C:/Users/mwalt/dev/workspaces/java/swagger-parser-ref/bin/lov-api.yaml works while both C:\Users\mwalt\dev\workspaces\java\swagger-parser-ref\src\main\resources\lov-api.yaml and src/main/resources/lov-api.yaml contain unresolved $refs

Filing a issue for the parser. Thanks for your help

abrahamaa commented 5 years ago

Hi, Am trying to generate golang code from a openapi v3 yaml file using openapi generator but am getting these error. Can you help identify what i might be doing wrong.

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i /Users/abraham/Desktop/NSSF/openapi-3.yaml -g go-server -o /Users/abraham/Desktop/NSSF/nrfDiscovery

sample ERROR:

[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Uri [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Uri [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Guami [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Guami [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Supi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Supi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv4Addr

..... ..

markus-wa commented 5 years ago

Have you tried ... -i file://path/to/spec.yml ... (potentially with 3 /)?

abrahamaa commented 5 years ago

hi, i have tried with 2 and 3 / but still having error. Am new to golang env and i may be doing somthing wrong. here is the full error if you can help:

abraham@afriyie:~/openapi-generator$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ///Users/abraham/Desktop/NSSF/openapi-3.yaml -g go-server -o /Users/abraham/Desktop/NSSF [main] WARN io.swagger.v3.parser.OpenAPIV3Parser - Exception while reading: java.lang.RuntimeException: Unable to load RELATIVE ref: ./TS29510_Nnrf_NFManagement.yaml path: /Users/abraham/Desktop/NSSF at io.swagger.v3.parser.util.RefUtils.readExternalRef(RefUtils.java:183) at io.swagger.v3.parser.ResolverCache.loadRef(ResolverCache.java:118) at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalSchema(ExternalRefProcessor.java:51) at io.swagger.v3.parser.processors.SchemaProcessor.processReferenceSchema(SchemaProcessor.java:202) at io.swagger.v3.parser.processors.SchemaProcessor.processSchema(SchemaProcessor.java:37) at io.swagger.v3.parser.processors.ParameterProcessor.processParameters(ParameterProcessor.java:139) at io.swagger.v3.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:39) at io.swagger.v3.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:84) at io.swagger.v3.parser.OpenAPIResolver.resolve(OpenAPIResolver.java:49) at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:53) at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:19) at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:552) at org.openapitools.codegen.cmd.Generate.run(Generate.java:346) at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:62) Caused by: java.lang.RuntimeException: Could not find ./TS29510_Nnrf_NFManagement.yaml on the classpath at io.swagger.v3.parser.util.ClasspathHelper.loadFileFromClasspath(ClasspathHelper.java:31) at io.swagger.v3.parser.util.RefUtils.readExternalRef(RefUtils.java:177) ... 13 common frames omitted [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Uri [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Uri [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Guami [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Guami [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Supi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Supi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv4Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv4Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Gpsi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Gpsi [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfGroupId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfGroupId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnai [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Dnai [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/SupportedFeatures [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/SupportedFeatures [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/AccessType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/AccessType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/NfInstanceId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFStatus [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFStatus [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/PlmnId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/PlmnId [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Snssai [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Snssai [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv4Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv4Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv6Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/Ipv6Addr [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/DateTime [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/DateTime [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceVersion [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceVersion [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/UriScheme [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/UriScheme [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceStatus [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceStatus [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/DateTime [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/DateTime [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfServiceInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfServiceInfo [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/SupportedFeatures [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/schemas/SupportedFeatures [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/400 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/403 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/404 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/411 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/413 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/415 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/500 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/501 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/503 [main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./TS29571_CommonData.yaml#/components/responses/default 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: 1, Warning count: 0 Errors: -Unable to load RELATIVE ref: ./TS29510_Nnrf_NFManagement.yaml path: /Users/abraham/Desktop/NSSF

at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:569)
at org.openapitools.codegen.cmd.Generate.run(Generate.java:346)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:62)

Thanks!

markus-wa commented 5 years ago

It's probably best if you open a new issue then. I doubt the OpenAPITools team will check closed issues. 🙂

lacksfish commented 5 years ago

For the impatient:

To fix my problem, I've used https://github.com/APIDevTools/json-schema-ref-parser (after turning my main yaml spec into json) and de-referenced all the $ref's automatically with the aforementioned tool.

Then, I was able to generate the client code :)

PSA: This is a hotfix and any code generated should be well tested.