-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
A spec like this:
openapi: 3.0.3
info:
title: api spec
version: 1.0.0
servers:
- url: /v3
components:
schemas:
$ref: './definitions/_index.yaml'
...
Results in validation error(s):
xception 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 components.schemas.$ref is not of type `object`
-attribute components.schemas.Schema name $ref doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:544)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:571)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:433)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
This is using docker.io/openapitools/openapi-generator-cli:latest (image id: e718a88b4de4). The spec with the schemas changed as below passes the validation:
openapi: 3.0.3
info:
title: api spec
version: 1.0.0
servers:
- url: /v3
components:
schemas:
UnauthorizedError:
$ref: "./definitions/unauthorized_error.yaml"
NotFoundError:
$ref: "./definitions/not_found_error.yaml"
...
According to 3.0 docs a $ref element should be valid immediately under schema.
ShauniArima, Philzen, Ivanbmstu, JakeAndrus, dpozinen and 5 more