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
  • #11696
Closed
Open
Issue created Feb 23, 2022 by Administrator@rootContributor

allOf in schema property results in generation of invalid Java methods "putXXXItem"

Created by: hoodihub

Disclaimer: I face these issues when generating a Java SDK, I don't know whether it affects other languages too.

Problem: I'm currently using version 5.3.0 of the generator, and with this version it generates some invalid methods for a schema's class, if the schema contains a property with an allOf element.

yaml:

 MyType:
      required:
      - category
      type: object
      properties:
        category:
          type: object
          description: |-
            <strong>Type:</strong> Category<br/>
            The category
          allOf:
          - $ref: '#/components/schemas/Category'

The generated java class for MyType contains this method which doesn't compile:

  public MyType putCategoryItem(String key,  categoryItem) {
    this.category.put(key, categoryItem);
    return this;
  }

First of all, you can see that there's no type declaration for the "categoryItem" parameter. Also, "this.category" is not a map, but a reference to the Category class (which is correct).

This whole method doesn't make sense to me. The previous version of the generator that I used was version 5.0.1, and that version didn't contain these invalid "putXXXItem" methods.

Can you explain where this comes from, and how I would have to change my yaml file so that those methods are no longer created?

Assignee
Assign to
Time tracking