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
  • Merge requests
  • !66

[java] Enum in array of array

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jmini/issue16 into master May 16, 2018
  • Overview 0
  • Commits 7
  • Pipelines 0
  • Changes 42

Created by: jmini

Fix for #16 (closed)


This PR introduces CodegenProperty.mostInnerItems and CodegenParameter.mostInnerItems that gives always the most inner items type when arrays are contained in arrays.

OAS2 (extract):

definitions:
  SomeObj:
    type: object
    properties:
      order:
        type: array
        items:
          type: array
          items:
            type: string
            enum:
              - val1
              - val2
              - val3

Example in Java: The CodegenProperty created for order defines the type List<List<OrderEnum>>.

Before this PR, if you want to access the CodegenProperty corresponding to the enum you need to do items.items (because we have an array of array of enum). The problem is that you do not know how many time you need to loop. If you just have a simple array of enum it will be items

In the Java code you often see this pattern:

                while (codegenProperty != null) {
                    codegenProperty = codegenProperty.items;
                }

To find the most inner items CodegenProperty

This PR introduces mostInnerItems that you can call at top level (you should check isContainer) and that gives you the items you are looking for (the one corresponding to OrderEnum in the example)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jmini/issue16