Swagger Codegen use existing class

后端 未结 3 2164
醉酒成梦
醉酒成梦 2021-02-15 16:06

How can I get the swagger codegen to use an existing class instead of creating a new class? Is this possible? For instance I want to use org.springframework.data.domain.Pa

3条回答
  •  失恋的感觉
    2021-02-15 16:19

    None of the answers mentioned here talked about what to add to the swagger yaml file, in case someone is interested this is something that worked for me:

    DisplayProperty:  
      type: object
      properties:
        name:
          type: string
        displayName:
          $ref: '#/components/schemas/Text'
        isRequired:
          type: boolean
          example: false
    Text:
        type: object
    

    and then have this in the pom

    
    Text=com.--.--.--.--.Text
    

提交回复
热议问题