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
  • #1125
Closed
Open
Issue created Sep 27, 2018 by Administrator@rootContributor

[Schema] Inline description and vendor extensions under allOf is not recognized

Created by: chenliu0831

Description

We have an use-case where description and vendor extensions are put inside allOf as inline schema. However those inlined fields went missing from the input to the generator as well as the final generated code. See below:

ModelA:
  allOf:
    - "$ref": "#/components/schemas/ModelBase"
    - type: object
      description: foo
      properties:
        value:
          type: integer
          description: TODO
      x-model-version: '1.0'
      x-model-module: model.base
  x-model-base: model.base.ModelBase@1.0

Debug output run with -DdebugModels which should be the same to any generators. Notice how top level x-model-base is getting picked up in vendorExtensions while the extensions are not.

"model" : {
    "parent" : "ModelBase",
    "parentSchema" : "ModelBase",
    "interfaces" : [ "ModelBase" ],
    "name" : "ModelA",
    "classname" : "ModelA",
    "classVarName" : "ModelA",
    "modelJson" : "{\n  \"allOf\" : [ {\n    \"$ref\" : \"#/components/schemas/ModelBase\"\n  }, {\n    \"type\" : \"object\",\n    \"properties\" : {\n      \"value\" : {\n        \"type\" : \"integer\",\n        \"description\" : \"TODO\",\n        \"format\" : \"int32\"\n      }\n    },\n    \"description\" : \"foo\",\n    \"x-model-version\" : \"1.0\",\n    \"x-model-module\" : \"model.base\"\n  } ],\n  \"x-model-base\" : \"model.base.ModelBase@1.0\"\n}",
    "classFilename" : "ModelA",
    "isAlias" : false,
    "isString" : false,
    "isInteger" : false,
    "vars" : [],
    "requiredVars" : [],
    "optionalVars" : [],
    "readOnlyVars" : [],
    "readWriteVars" : [],
    "allVars" : [],
    "parentVars" : [ ],
    "mandatory" : [ ],
    "allMandatory" : [ ],
    "imports" : [ "AttributeMetadata", "ModelBase" ],
    "hasVars" : true,
    "emptyVars" : false,
    "hasMoreModels" : false,
    "hasEnums" : false,
    "isEnum" : false,
    "hasRequired" : false,
    "hasOptional" : true,
    "isArrayModel" : false,
    "hasChildren" : false,
    "isMapModel" : false,
    "hasOnlyReadOnly" : false,
    "vendorExtensions" : {
      "x-model-base" : "model.base.ModelBase@1.0"
    }
  }
}

According to the schema object spec, either way seems to be valid. Is this a bug, a feature by design or I misunderstand anything?

Thanks.

openapi-generator version

3.3.2, also happens with master.

Assignee
Assign to
Time tracking