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
  • #7949
Closed
Open
Issue created Nov 16, 2020 by Administrator@rootContributor

Is allOf + properties valid?

Created by: KevinMitchell

Description

If I define

  schemas:
    T:
      type: object
      properties:
        a:
          type: string
        b:
          type: string
    S:
      allOf:
      - $ref: '#/components/schemas/T'
      - type: object
        properties:
          x:
            type: string
          y:
            type: string

then the Java code generator expands out T's properties in the class generated for S. So there's no inheritance. If I rewrite the definition of S to look like this

    S:
      allOf:
        - $ref: '#/components/schemas/T'
      properties:
        x:
          type: string
        y:
          type: string

then there are no errors reported and S is defined as inheriting from T. But it's not clear to me whether this is actually a legal OA3 specification, and other OA3 tooling complains. So is there a definitive statement anywhere that says this is or isn't allowed? Most of the statements I've seen are just based on the behaviour of particular tools. And as the amount of tooling increases this isn't really a sustainable approach. If this isn't valid then it's not clear to me how to rewrite the example so it's valid, and the code generator produces the same output as the invalid example.

openapi-generator version

5.0.0, spring/spring-boot

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Assignee
Assign to
Time tracking