Skip to content

'AllOf' is problematic for Code Generation #95

@sebbader-sap

Description

@sebbader-sap

What?

Inheritance through 'allOf' statements in OpenAPI leads to duplicating of fields in the generated code, e.g. for LangStrings:

https://app.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0#/components/schemas/AbstractLangString:

    AbstractLangString:
      type: object
      properties:
        language:
          type: string
          pattern: "..."
        text:
          type: string
          minLength: 1
          pattern: "..."
      required:
      - language
      - text

https://app.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0#/components/schemas/LangStringNameType:

    LangStringDefinitionTypeIec61360:
      allOf:
      - "$ref": "#/components/schemas/AbstractLangString"
      - properties:
          text:
            maxLength: 1023

Result:
Generated class for LangStringDefinitionTypeIec61360 has two fields called text.

How?

Define text not on the inherited class level but on the lowest possible?

This issue relates to finding DFKI#01.

Metadata

Metadata

Assignees

Labels

Part1Needs to be discussed in Part1

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions