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

[BUG][Java] OpenApi3 to Angular model - generation with oneOf

Created by: pdlk

While generating angular model based on openapi3 json specification, the entity of model generated for types marked as "oneOf" has wrong name including "oneOf" prefix. But this type is not available because it is generated in separated file with proper name without this prefix.

OpenApi Generator: openapi-generator-cli-4.0.3.jar

Initial c# class:

public class ProfileDetail
{
    public ProfileData TypicalCustomerProfile { get; set; }
    public ProfileData OutlierCustomerProfile { get; set; }
}

Input OpenApi3 JSON definition:

  "ProfileDetail": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "typicalCustomerProfile": {
        "nullable": true,
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProfileData"
          }
        ]
      },
      "outlierCustomerProfile": {
        "nullable": true,
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProfileData"
          }
        ]
      }
    }
  },

Generated model - incorrect:

import { OneOfProfileData } from './oneOfProfileData';

export interface ProfileDetail { typicalCustomerProfile?: OneOfProfileData | null; outlierCustomerProfile?: OneOfProfileData | null; }

Expected:

import { ProfileData } from './ProfileData';

export interface ProfileDetail { typicalCustomerProfile?: ProfileData | null; outlierCustomerProfile?: ProfileData | null; }

Assignee
Assign to
Time tracking