Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #10435
Closed
Open
Issue created Sep 20, 2021 by Administrator@rootContributor

[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
  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
Assignee
Assign to
Time tracking