Skip to content

[BUG] references to external files does not work #3233

@YishTish

Description

@YishTish

Description

Generating code with references to external files does not work (used to work in V2).

stack trace (last lines):

> [main] WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: ./event.json#/schemas/event
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:
	-null

	at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:606)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:395)
	at 

> org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)

openapi-generator version

4.0.2

OpenAPI declaration file content or url

https://gist.github.com/YishTish/d2f8335e6027f4d50beec84abdf20b90

Command line used for generation

regular bash: openapi-generator generate -i openapi.json -g openapi-yaml -o generated/

Steps to reproduce

Just run the code with the jsons specified.

Related issues/PRs

#3026

Suggest a fix

When $ref starts with './', change behaviour to pick up the data from external file. Note that the file location is always relative, and absolute path can (should?) be considered wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions