Skip to content

[BUG] allOff to overwrite the description of a string schema results in faulty java code #14473

Closed
@icorne

Description

@icorne
Description

allOf to overwrite the description of a $ref string does not work in the java generator

openapi-generator version

6.2.0

OpenAPI declaration file content or url
---
swagger: "2.0"
info:
  description: Test API
  version: 1.0.0
  title: Test Api
basePath: /
tags:
- name: test
  description: test
schemes:
- https
paths:
  /test:
    get:
      tags:
      - test
      summary: test
      operationId: getTest
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            type: object
            properties:
              one:
                type: array
                items:
                  $ref: '#/definitions/Test'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
definitions:
  BaseTest:
    type: string
    description: 'I am base'
    example: 'an example'
  Test:
    properties:
      base:
        allOf:
          - $ref: '#/definitions/BaseTest'
          - description: 'Overwritten description'
Generation Details

openapi-generator-cli generate -i allOfStringDescription.yaml -g spring
openapi-generator-cli generate -i allOfStringDescription.yaml -g java

Steps to reproduce

compile the resulting code
image

Suggest a fix

It used to work in 4.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions