Swag: Change Model Name in Api DOC

Created on 13 Mar 2019  路  3Comments  路  Source: swaggo/swag

Hi, is it possible for me to change my Model name that is displayed in Swagger UI ?
for example:

// @Success 200 {array} model.Account <-- This is a user defined struct.

in the Swagger UI it would display model.Account, and personally i would like to change model.Account > User or Account instead of model.Account for a cleaner docs.

Thanks

Most helpful comment

thanks for the reply !

Sorry for the wrong explanation above since i put the data type as {array}, what I mean is, if the data type is struct how do we rename the struct name in the doc
For example I have a

// @Param body body request.SomeStruct true "Request Body Comment"

after generated using ./swag init
and visit the swagger routes, i would have the API Doc generated but the request body in doc is written as request.SomeStruct and its property,
I would like to change the name from request.SomeStruct to AccountRequest or something
is it possible ?

thanks.

@pei0804

All 3 comments

Yes. You can change.
Account is struct name.
@welenlin

If you have problem reopen issue.

thanks for the reply !

Sorry for the wrong explanation above since i put the data type as {array}, what I mean is, if the data type is struct how do we rename the struct name in the doc
For example I have a

// @Param body body request.SomeStruct true "Request Body Comment"

after generated using ./swag init
and visit the swagger routes, i would have the API Doc generated but the request body in doc is written as request.SomeStruct and its property,
I would like to change the name from request.SomeStruct to AccountRequest or something
is it possible ?

thanks.

@pei0804

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nerzal picture Nerzal  路  6Comments

piwan picture piwan  路  6Comments

dz0ny picture dz0ny  路  5Comments

chyroc picture chyroc  路  3Comments

Ashtonian picture Ashtonian  路  6Comments