Skip to content

[BUG][Typescript] Invalid oneOf  #11679

Closed
@ksvirkou-hubspot

Description

@ksvirkou-hubspot

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 version

5.4.0

OpenAPI declaration file content or url
"inputFieldDependencies": {
    "type": "array",
    "description": "",
    "items": {
        "oneOf": [
            {
                "$ref": "#/components/schemas/SingleFieldDependency"
            },
            {
                "$ref": "#/components/schemas/ConditionalSingleFieldDependency"
            }
        ]
    }
}
Generation Details

generate -i *.json -g typescript -o /dir --skip-validate-spec --additional-properties usePromises=true,supportsES6=true,platform=node

Output
import { ConditionalSingleFieldDependency } from './ConditionalSingleFieldDependency';
import { SingleFieldDependency } from './SingleFieldDependency';
import { SingleFieldDependency | ConditionalSingleFieldDependency } from './SingleFieldDependency | ConditionalSingleFieldDependency';

It added incorrect import

Expected output

import { ConditionalSingleFieldDependency } from './ConditionalSingleFieldDependency';
import { SingleFieldDependency } from './SingleFieldDependency';

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