77
88import io .swagger .v3 .oas .annotations .Operation ;
99import io .swagger .v3 .oas .annotations .Parameter ;
10+ import io .swagger .v3 .oas .annotations .enums .Explode ;
11+ import io .swagger .v3 .oas .annotations .enums .ParameterIn ;
12+ import io .swagger .v3 .oas .annotations .enums .ParameterStyle ;
1013import io .swagger .v3 .oas .annotations .enums .SecuritySchemeType ;
1114import io .swagger .v3 .oas .annotations .media .ArraySchema ;
1215import io .swagger .v3 .oas .annotations .media .Content ;
2023import org .springframework .http .ResponseEntity ;
2124import org .springframework .web .bind .annotation .*;
2225import org .springframework .web .multipart .MultipartFile ;
23-
2426import javax .validation .Valid ;
2527import javax .validation .constraints .NotNull ;
2628import java .util .List ;
2729
28- @ SecurityScheme (name = "petstore_auth" , type = SecuritySchemeType .OAUTH2 , flows = @ OAuthFlows (implicit = @ OAuthFlow (authorizationUrl = "http ://petstore .swagger.io/oauth/dialog " , scopes = {
29- @ OAuthScope (name = "write:pets" , description = "modify pets in your account" ),
30- @ OAuthScope (name = "read:pets" , description = "read your pets" ) })))
30+ @ SecurityScheme (name = "petstore_auth" , type = SecuritySchemeType .OAUTH2 , flows = @ OAuthFlows (implicit = @ OAuthFlow (authorizationUrl = "https ://petstore3 .swagger.io/oauth/authorize " , scopes = {
31+ @ OAuthScope (name = "write:pets" , description = "modify pets in your account" ),
32+ @ OAuthScope (name = "read:pets" , description = "read your pets" )})))
3133@ Tag (name = "pet" , description = "the pet API" )
3234public interface PetApi {
3335
@@ -36,23 +38,25 @@ default PetApiDelegate getDelegate() {
3638 };
3739 }
3840
39- @ Operation (summary = "Add a new pet to the store" , description = "" , security = {
40- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
41- @ ApiResponses (value = { @ ApiResponse (responseCode = "405" , description = "Invalid input" ) })
42- @ PostMapping (value = "/pet" , consumes = { "application/json" , "application/xml" })
41+ @ Operation (summary = "Add a new pet to the store" , description = "Add a new pet to the store" , security = {
42+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" })}, tags = {"pet" })
43+ @ ApiResponses (value = {
44+ @ ApiResponse (responseCode = "200" , description = "Successful operation" , content = {@ Content (mediaType = "application/xml" , schema = @ Schema (implementation = Pet .class )), @ Content (mediaType = "application/json" , schema = @ Schema (implementation = Pet .class ))}),
45+ @ ApiResponse (responseCode = "405" , description = "Invalid input" )
46+ })
47+ @ PostMapping (value = "/pet" , consumes = {"application/json" , "application/xml" , "application/x-www-form-urlencoded" })
4348 default void addPet (
44- @ Parameter (description = "Pet object that needs to be added to the store" , required = true ) @ Valid @ RequestBody Pet pet ) {
49+ @ Parameter (description = "Create a new pet in the store" , required = true ) @ Valid @ RequestBody Pet pet ) {
4550 // return getDelegate().addPet(pet);
4651 }
4752
48- @ Operation (summary = "Deletes a pet" , description = "" , security = {
49- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
50- @ ApiResponses (value = { @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
51- @ ApiResponse (responseCode = "404" , description = "Pet not found" ) })
52- @ DeleteMapping (value = "/pet/{petId}" )
53+ @ Operation (summary = "Deletes a pet" , description = "" , security = {
54+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" })}, tags = {"pet" })
55+ @ ApiResponses (value = {@ ApiResponse (responseCode = "400" , description = "Invalid pet value" )})
56+ @ DeleteMapping (value = "/pet/{petId}" )
5357 default ResponseEntity <Void > deletePet (
54- @ Parameter (description = "Pet id to delete" , required = true ) @ PathVariable ("petId" ) Long petId ,
55- @ Parameter (description = "" ) @ RequestHeader (value = "api_key" , required = false ) String apiKey ) {
58+ @ Parameter (description = "Pet id to delete" , required = true ) @ PathVariable ("petId" ) Long petId ,
59+ @ Parameter (description = "" ) @ RequestHeader (value = "api_key" , required = false ) String apiKey ) {
5660 return getDelegate ().deletePet (petId , apiKey );
5761 }
5862
@@ -62,66 +66,72 @@ default ResponseEntity<Void> deletePet(
6266 @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (array = @ ArraySchema (schema = @ Schema (implementation = Pet .class )))),
6367 @ ApiResponse (responseCode = "400" , description = "Invalid status value" ) })
6468 @ GetMapping (value = "/pet/findByStatus" , produces = { "application/xml" , "application/json" })
65- default ResponseEntity <List <Pet >> findPetsByStatus (
66- @ NotNull @ Parameter (description = "Status values that need to be considered for filter" , required = true ) @ Valid @ RequestParam (value = "status" , required = true ) List <String > status ) {
69+ default ResponseEntity <List <Pet >> findPetsByStatus (@ Parameter (explode = Explode .TRUE , name = "status" , in = ParameterIn .QUERY , description = "Status values that need to be considered for filter" , style = ParameterStyle .FORM , schema = @ Schema (type = "string" , defaultValue = "available" , allowableValues = {"available" , "pending" , "sold" })) @ Valid @ RequestParam (value = "status" , required = false ) List <String > status ) {
6770 return getDelegate ().findPetsByStatus (status );
6871 }
6972
70- @ Operation (summary = "Finds Pets by tags" , description = "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." , security = {
71- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
72- @ ApiResponses (value = {
73- @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (array = @ ArraySchema (schema = @ Schema (implementation = Pet .class )))),
74- @ ApiResponse (responseCode = "400" , description = "Invalid tag value" ) })
75- @ GetMapping (value = "/pet/findByTags" , produces = { "application/xml" , "application/json" })
73+ @ Operation (summary = "Finds Pets by tags" , description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." , security = {
74+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" }) }, tags = {"pet" })
75+ @ ApiResponses (value = {
76+ @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (array = @ ArraySchema (schema = @ Schema (implementation = Pet .class )))),
77+ @ ApiResponse (responseCode = "400" , description = "Invalid tag value" , content = @ Content ) })
78+ @ GetMapping (value = "/pet/findByTags" , produces = {"application/xml" , "application/json" })
7679 default ResponseEntity <List <Pet >> findPetsByTags (
77- @ NotNull @ Parameter (description = "Tags to filter by" , required = true ) @ Valid @ RequestParam (value = "tags" , required = true ) List <String > tags ) {
80+ @ Parameter (description = "Tags to filter by" , explode = Explode . TRUE , in = ParameterIn . QUERY , name = "tags" , style = ParameterStyle . FORM ) @ Valid @ RequestParam (value = "tags" , required = false ) List <String > tags ) {
7881 return getDelegate ().findPetsByTags (tags );
7982 }
8083
81- @ Operation (summary = "Find pet by ID" , description = "Returns a single pet" , security = {
82- @ SecurityRequirement (name = "api_key" ) }, tags = { "pet" })
83- @ ApiResponses (value = {
84- @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (schema = @ Schema (implementation = Pet .class ))),
85- @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
86- @ ApiResponse (responseCode = "404" , description = "Pet not found" ) })
87- @ GetMapping (value = "/pet/{petId}" , produces = { "application/xml" , "application/json" })
84+ @ Operation (summary = "Find pet by ID" , description = "Returns a single pet" , security = {
85+ @ SecurityRequirement (name = "api_key" ),
86+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" })
87+ }, tags = {"pet" })
88+ @ ApiResponses (value = {
89+ @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (schema = @ Schema (implementation = Pet .class ))),
90+ @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" , content = @ Content ),
91+ @ ApiResponse (responseCode = "404" , description = "Pet not found" , content = @ Content )})
92+ @ GetMapping (value = "/pet/{petId}" , produces = {"application/xml" , "application/json" })
8893 default ResponseEntity <Pet > getPetById (
89- @ Parameter (description = "ID of pet to return" , required = true ) @ PathVariable ("petId" ) Long petId ) {
94+ @ Parameter (description = "ID of pet to return" , required = true ) @ PathVariable ("petId" ) Long petId ) {
9095 return getDelegate ().getPetById (petId );
9196 }
9297
93- @ Operation (summary = "Update an existing pet" , description = "" , security = {
94- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
95- @ ApiResponses (value = { @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
96- @ ApiResponse (responseCode = "404" , description = "Pet not found" ),
97- @ ApiResponse (responseCode = "405" , description = "Validation exception" ) })
98- @ PutMapping (value = "/pet" , consumes = { "application/json" , "application/xml" })
98+ @ Operation (summary = "Update an existing pet" , description = "Update an existing pet by Id" , operationId = "updatePet" , security = {
99+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" })}, tags = {"pet" })
100+ @ ApiResponses (value = {
101+ @ ApiResponse (responseCode = "200" , description = "Successful operation" ,
102+ content =
103+ {@ Content (mediaType = "application/xml" , schema = @ Schema (implementation = Pet .class )), @ Content (mediaType = "application/json" , schema = @ Schema (implementation = Pet .class ))}
104+ ),
105+ @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
106+ @ ApiResponse (responseCode = "404" , description = "Pet not found" ),
107+ @ ApiResponse (responseCode = "405" , description = "Validation exception" )})
108+ @ PutMapping (value = "/pet" , consumes = {"application/json" , "application/xml" , "application/x-www-form-urlencoded" })
99109 default ResponseEntity <Void > updatePet (
100- @ Parameter (description = "Pet object that needs to be added to the store" , required = true ) @ Valid @ RequestBody Pet pet ) {
110+ @ Parameter (description = "Update an existent pet in the store" , required = true ) @ Valid @ RequestBody Pet pet ) {
101111 return getDelegate ().updatePet (pet );
102112 }
103113
104- @ Operation (summary = "Updates a pet in the store with form data" , description = "" , security = {
105- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
106- @ ApiResponses (value = { @ ApiResponse (responseCode = "405" , description = "Invalid input" ) })
107- @ PostMapping (value = "/pet/{petId}" , consumes = { "application/x-www-form-urlencoded" })
114+ @ Operation (summary = "Updates a pet in the store with form data" , description = "" , security = {
115+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" }) }, tags = {"pet" })
116+ @ ApiResponses (value = {@ ApiResponse (responseCode = "405" , description = "Invalid input" )})
117+ @ PostMapping (value = "/pet/{petId}" , consumes = {"application/x-www-form-urlencoded" })
108118 default ResponseEntity <Void > updatePetWithForm (
109- @ Parameter (description = "ID of pet that needs to be updated" , required = true ) @ PathVariable ("petId" ) Long petId ,
110- @ Parameter (description = "Updated name of the pet" ) @ RequestParam (value = "name" , required = false ) String name ,
111- @ Parameter (description = "Updated status of the pet" ) @ RequestParam (value = "status" , required = false ) String status ) {
119+ @ Parameter (description = "ID of pet that needs to be updated" , required = true ) @ PathVariable ("petId" ) Long petId ,
120+ @ Parameter (description = "Name of pet that needs to be updated " ) @ RequestParam (value = "name" , required = false ) String name ,
121+ @ Parameter (description = "Status of pet that needs to be updated " ) @ RequestParam (value = "status" , required = false ) String status ) {
112122 return getDelegate ().updatePetWithForm (petId , name , status );
113123 }
114124
115- @ Operation (summary = "uploads an image" , description = " " , security = {
116- @ SecurityRequirement (name = "petstore_auth" , scopes = { "write:pets" , "read:pets" }) }, tags = { "pet" })
117- @ ApiResponses (value = {
118- @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (schema = @ Schema (implementation = ModelApiResponse .class ))) })
119- @ PostMapping (value = "/pet/{petId}/uploadImage" , produces = { "application/json" }, consumes = {
120- "multipart/form-data" })
125+ @ Operation (summary = "uploads an image" , security = {
126+ @ SecurityRequirement (name = "petstore_auth" , scopes = {"write:pets" , "read:pets" }) }, tags = {"pet" })
127+ @ ApiResponses (value = {
128+ @ ApiResponse (responseCode = "200" , description = "successful operation" , content = @ Content (schema = @ Schema (implementation = ModelApiResponse .class )))})
129+ @ PostMapping (value = "/pet/{petId}/uploadImage" , produces = {"application/json" }, consumes = {
130+ "application/octet-stream" })
121131 default ResponseEntity <ModelApiResponse > uploadFile (
122- @ Parameter (description = "ID of pet to update" , required = true ) @ PathVariable ("petId" ) Long petId ,
123- @ Parameter (description = "Additional data to pass to server " ) @ RequestParam (value = "additionalMetadata" , required = false ) String additionalMetadata ,
124- @ Parameter ( description = "file detail" ) @ Valid @ RequestPart ("file" ) MultipartFile file ) {
132+ @ Parameter (description = "ID of pet to update" , required = true ) @ PathVariable ("petId" ) Long petId ,
133+ @ Parameter (description = "Additional Metadata " ) @ RequestParam (value = "additionalMetadata" , required = false ) String additionalMetadata ,
134+ @ io . swagger . v3 . oas . annotations . parameters . RequestBody ( content = @ Content ( mediaType = "application/octet-stream" , schema = @ Schema ( type = "string" , format = "binary" )) ) @ Valid @ RequestPart ("file" ) MultipartFile file ) {
125135 return getDelegate ().uploadFile (petId , additionalMetadata , file );
126136 }
127137
0 commit comments