java - How can I use my own annotation for Swagger? -
how can use own annotation building swagger ui page. example defined annotation , use it:
@put @myownannotationforadditionalpropinswagger(value = "some text") @path( "/{carid}" ) @consumes(mediatype.application_json) @produces(mediatype.application_json) @apioperation( value = "updates car info" ) public response patchitem(@apiparam(value = "fields update") car item) { /*some code*/ } after should extend class swagger-core , specify scan annotation (@myownannotationforadditionalpropinswagger).
as result want see additional column in swagger ui text.
how can realize it? class need extend?
the swagger 2.0 supports custom fields, there pull request in 2013 (https://github.com/swagger-api/swagger-node/pull/47).
while apparently it's easy add custom fields, since not present in swagger 2.0 spec, swagger-ui won't display them default.
for work have change couple of things.
- implement desired annotation in parser implementation (ie.
swagger-coreorswagger-php) if doesn't exist. - clone , modify
swagger-uidisplay custom field wish.
note doing in fact violate swagger json schema (https://github.com/swagger-api/swagger-spec/blob/master/schemas/v2.0/schema.json) , third party validators may use fail.
Comments
Post a Comment