Reputation: 3042
I am writing swagger documentation(swagger.json) for my project(which is done and alive). Now i have a problem with modelling my object. I have a object called "Listing", Which is used to handle both "applications" and "services" internally.
Now in my definition i want to have two objects, one with applications related fields and one with service related fields . But i want to keep the name listing to both the objects,because in the swagger-ui i want the both of the objects to be displayed as listing(since the APIs are already used by users)
Any help?
Thanks.
Upvotes: 4
Views: 5871
Reputation: 87
With out adding unique named classes
, you can do this by customizing schema name
for swagger documentation
.
@Schema(name = "ApplicationListing")
and
@Schema(name = "ServiceListing")
Upvotes: 1
Reputation: 98102
Schema names must be unique, such as ApplicationListing
and ServiceListing
. But you can set the schema title
to customize the schema name displayed in Swagger UI.
definitions:
ApplicationListing:
title: Listing
description: Application listing
type: object
...
ServiceListing:
title: Listing
description: Service listing
type: object
...
Upvotes: 3