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
  • #3589
Closed
Open
Issue created Aug 08, 2019 by Administrator@rootContributor

[JAVA] incorrect import mapping of alias types

Created by: bkoziak

[JAVA] incorrect import mapping of alias types

Description

Hi guys,

I've hit the wall trying to use importMapping together with type aliases. I'm a newbie when it comes to openapi so forgive me if I used wrong terms or something. Here's an example of what I wanted to achieve (use below yaml as a reference):

  1. I've created TypeAlias which aliases string
  2. I used TypeAlias as $ref for property typeAlias of ParentType schema
  3. I configured openapi-generator-maven-plugin to map TypeAlias to foo.bar.TypeAlias
  4. As a result typeAlias was generated as String instead of foo.bar.TypeAlias
openapi-generator version

master - 4.1.0-SNAPSHOT, 4.0.0, 3.x.x

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0
paths:
  /type-alias:
    get:
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParentType'

components:
  schemas:
    ParentType:
      title: ParentType
      type: object
      properties:
        typeAlias:
          $ref: '#/components/schemas/TypeAlias'
    TypeAlias:
      type: string
Command line used for generation

Maven plugin with following importMapping configuration:

<importMappings>
    <importMapping>TypeAlias=foo.bar.TypeAlias</importMapping>
</importMappings>
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Assignee
Assign to
Time tracking