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
  • #634
Closed
Open
Issue created Jul 24, 2018 by Administrator@rootContributor

[Java] Add proper support for allOf anyOf oneOf

Created by: MarvGilb

Description

In the openApiSpec it is possible to define a schema with properties, where one property can be defined directly or be using oneOf anyOf or allOf and passing the some provided Schemas.

Currently only allOf is considered and only the first of these schemas is taken (allOf requires all of them!). The other two delimiter are not even considered.

The following example makes it only possible to set the CustomProperties.

openapi-generator version

3.1.1

OpenAPI declaration file content or url

Sample Snippet.:

info:
  title: test
  version: 1.0.0
paths:
  /test:
    get:
      responses:
        '200':
          description: All good
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ObjectWithProps'
      operationId: get
      summary: Get object with properties.
components:
  schemas:
    ObjectWithProps:
      properties:
        properties:
          allOf:
           - $ref: '#/components/schemas/CustomProperties'
           - $ref: '#/components/schemas/Properties'
      description: An object with difined and undifined keys.
    CustomProperties:
      description: The custom properties key.
      type: object
      properties:
        'someDefinedKey':
          type: object
          additionalProperties:
            type: object
    Properties:
      description: The wildcard properties key.
      type: object
      additionalProperties:
        type: object
openapi: 3.0.0
Steps to reproduce
java -jar ${PathToOpenApiGeneratorJAR3.1.1} generate \
 -i /path/swagger3.yaml \
 -o /path/swagger3-client \
 --api-package "com.123" \
 --model-package "com.123" \
 --group-id "com.123" \
 --artifact-id "123" \
 --artifact-version "SNAPSHOT" \
 -c ./java-options.json \
 -g java

JavaOptions:

{
  "java8": true,
  "dateLibrary": "java8"
}
Assignee
Assign to
Time tracking