SledgeHammer
SledgeHammer

Reputation: 7714

Domain class vs. Dto class vs. naming for Swagger

I have a case where my hibernate Customer object needs to be a little bit different then the one exposed in my rest api, so I am using the dto pattern.

So, the rest api uses the CustomerDto object and the internal object is just Customer correct? Kind of OCD, but I'd rather have Swagger show it as "Customer" vs. "CustomerDto", no?

Is there a way to change the class name that Swagger shows, akin to @JsonProperty?

Upvotes: 1

Views: 769

Answers (1)

pepevalbe
pepevalbe

Reputation: 1380

You can use the @ApiModel Swagger annotation for that. Just annotate your DTO class with:

@ApiModel(value = "Customer")

Upvotes: 3

Related Questions