Forum Discussion

belgi's avatar
belgi
New Contributor
5 years ago

Swagger json format that works for codegen and redoc

I want swagger-codegen to generate a function Foo with two parameters of the same type. For example Foo(User first, User second).

For this to work, both "first" and "second" have the same $ref pointing to User.

 

However, in this case I can not have the redoc use two distinct description fields and I get that both "first" and "second" has the same description - the one pointed to by $ref.

What can I do to have something that generated code with the same classes as in the example of Foo but also allows for two different descriptions to be used ? 

3 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    To add description to a $ref, you can wrap the $ref into allOf:

    first:
      description: The first user
      allOf:
        - $ref: '#/definitions/User'