[spring/spring-boot] API generation fails when specification refs a requestBody with object type schema
Created by: rhamiltonsf
Description
Using the following schema, the openapi-generator-maven-plugin fails to recognize the model in the requestBody schema, and instead tries to import and use a model named UNKNOWN_BASE_TYPE
. This only happens when I use a ref to the requestBody and if the requestBody schema is of type object.
openapi-generator version
5.2.1 5.1.0 4.3.1
OpenAPI declaration file content or URL
Here is a minimum spec that reproduces the issue.
However note that this spec and this other spec both work.
Command line used for generation
This occurred using the openapi-generator-maven-plugin. See example pom here for configurations.
Steps to reproduce
- create a new maven project using this pom.
- Create src/main/resources directory and, add api.yaml to it
- run
mvn clean install
from the pom directory
Expected Results: The command should execute successfully and generate default API models, interfaces, and delegate.
Actual Results:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] ~/testproject/target/generated-sources/openapi/api/org/openapitools/api/DefaultApi.java:[8,30] package org.openapitools.model does not exist
[ERROR] ~/testproject/target/generated-sources/openapi/api/org/openapitools/api/DefaultApiDelegate.java:[3,30] package org.openapitools.model does not exist
[ERROR] ~/testproject/target/generated-sources/openapi/api/org/openapitools/api/DefaultApi.java:[43,106] cannot find symbol
symbol: class UNKNOWN_BASE_TYPE
location: interface org.openapitools.api.DefaultApi
[ERROR] ~/testproject/target/generated-sources/openapi/api/org/openapitools/api/DefaultApiDelegate.java:[33,43] cannot find symbol
symbol: class UNKNOWN_BASE_TYPE
location: interface org.openapitools.api.DefaultApiDelegate