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
  • #4431
Closed
Open
Issue created Nov 09, 2019 by Administrator@rootContributor0 of 6 checklist items completed0/6 checklist items

[BUG] openapi-generators oneOfs are broken

Created by: simllll

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I've reported the issue already at the swagger-api, but swithed to this fork recently, unfortantely the issue is not solved here either.

Swagger Definition 2 works! https://test.hokify.com/ats-api/swagger.yaml Swagger Deifntion 3 / Open API is broken when using "oneOf" with strings and objects. https://test.hokify.com/ats-api/openapi.yaml

running java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i dist/swagger/swagger.yaml -g html2 -o docs

generated a broken html2 output.

If I remove the occurences of "oneOf" and replace them by "type: string" it starts working.

                from:
                    oneOf:
                        -
                            type: string
                        -
                            properties:
                                name:
                                    type: string
                                address:
                                    type: string
                            required:
                                - address
                                - name
                            type: object
                    nullable: true
replyTo:
                    oneOf:
                        -
                            type: string
                        -
                            properties:
                                name:
                                    type: string
                                address:
                                    type: string
                            required:
                                - address
                                - name
                            type: object
                    nullable: true
 type:
                    oneOf:
                        -
                            $ref: '#/components/schemas/UserExtraType'
                        -
                            type: string
openapi-generator version

Building via docker openapitools/openapi-generator-cli:latest (updated 4 hours ago)

OpenAPI declaration file content or url

Swagger Definition 2 works! https://test.hokify.com/ats-api/swagger.yaml Swagger Deifntion 3 / Open API is broken when using "oneOf" with strings and objects. https://test.hokify.com/ats-api/openapi.yaml

Command line used for generation

I'm geneating the defintions files with tsoa, I also opened an issue at tsoa's github page, and we checked that the issue is definitly not related to tsoa itself. The swagger file is valid, the generator seems to produce broken output here. See also https://github.com/lukeautry/tsoa/issues/474

Steps to reproduce

generate html2 docuematation with the open api defintion file:

java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i dist/swagger/swagger.yaml -g html2 -o docs

Related issues/PRs

there are some issues reagrding "oneOf", but none that describes this bug in my opinion.

Suggest a fix

Unfortunatnely no idea how to fix this.. I assume it is something in the underlying library, due to the fact that a lot of output modes are affected (not only html2, also e.g. php client,..).

Assignee
Assign to
Time tracking