Skip to content

[BUG][JAVA] UNKNOWN_BASE_TYPE when using $ref to model in requestBodies #11811

@Swiftwork

Description

@Swiftwork

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Openapi generator fails to handle $ref to model in requestBodies resulting in UNKOWN_BASE_TYPE.

openapi-generator version

Version: 5.4.0
Might be a regression as this has been mentioned before: #2575

OpenAPI declaration file content or url
openapi: 3.0.0
paths:
  /user:
    post:
      summary: Create New User
      operationId: post-user
      requestBody:
        $ref: '#/components/requestBodies/UserPost'
      responses:
        '200':
          description: OK
components:
  requestBodies:
    UserPost:
      content:
        application/json:
          schema:
            type: object
            properties:
              firstName:
                type: string
              lastName:
                type: string
Generation Details

Using typescript-fetch

openapi-generator-cli generate -g typescript-fetch -i spec.yaml -o gen
Steps to reproduce

Reproduction

Related issues/PRs

#2575

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