Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spring/spring-boot] API generation fails when specification refs a requestBody with object type schema #10435

Closed
rhamiltonsf opened this issue Sep 20, 2021 · 1 comment

Comments

@rhamiltonsf
Copy link

rhamiltonsf commented Sep 20, 2021

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
  1. create a new maven project using this pom.
  2. Create src/main/resources directory and, add api.yaml to it
  3. 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
Related issues/PRs
Suggest a fix/enhancement
@wing328
Copy link
Member

wing328 commented May 10, 2022

#12293 has been merged into master. Please pull the latest to give it a try.

@wing328 wing328 closed this as completed May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants