22
22
import org .eclipse .microprofile .openapi .annotations .enums .SchemaType ;
23
23
import org .eclipse .microprofile .openapi .annotations .enums .SecuritySchemeIn ;
24
24
import org .eclipse .microprofile .openapi .annotations .enums .SecuritySchemeType ;
25
- import org .eclipse .microprofile .openapi .annotations .extensions .Extension ;
26
- import org .eclipse .microprofile .openapi .annotations .extensions .Extensions ;
27
25
import org .eclipse .microprofile .openapi .annotations .media .Content ;
28
26
import org .eclipse .microprofile .openapi .annotations .media .ExampleObject ;
29
27
import org .eclipse .microprofile .openapi .annotations .media .Schema ;
62
60
import jakarta .ws .rs .core .StreamingOutput ;
63
61
64
62
@ Path ("/pet" )
65
- @ Schema (name = "pet" , description = "Operations on pets resource" )
66
63
@ SecuritySchemes (value = {
67
64
@ SecurityScheme (securitySchemeName = "petsApiKey" , type = SecuritySchemeType .APIKEY ,
68
65
description = "authentication needed to create a new pet profile for the store" ,
69
66
apiKeyName = "createPetProfile" , in = SecuritySchemeIn .HEADER ),
70
67
@ SecurityScheme (securitySchemeName = "petsOAuth2" , type = SecuritySchemeType .OAUTH2 ,
71
68
description = "authentication needed to delete a pet profile" ,
72
- flows = @ OAuthFlows (implicit = @ OAuthFlow (authorizationUrl = "https://example.com/api/oauth/dialog" ),
69
+ flows = @ OAuthFlows (implicit = @ OAuthFlow (authorizationUrl = "https://example.com/api/oauth/dialog" ,
70
+ scopes = {}),
73
71
authorizationCode = @ OAuthFlow (authorizationUrl = "https://example.com/api/oauth/dialog" ,
74
- tokenUrl = "https://example.com/api/oauth/token" ))),
72
+ tokenUrl = "https://example.com/api/oauth/token" ,
73
+ scopes = {}))),
75
74
@ SecurityScheme (securitySchemeName = "petsHttp" , type = SecuritySchemeType .HTTP ,
76
75
description = "authentication needed to update an exsiting record of a pet in the store" ,
77
76
scheme = "bearer" , bearerFormat = "jwt" )
@@ -87,6 +86,7 @@ public class PetResource {
87
86
content = @ Content (mediaType = "none" )),
88
87
@ APIResponse (responseCode = "404" , description = "Pet not found" , content = @ Content (mediaType = "none" )),
89
88
@ APIResponse (responseCode = "200" ,
89
+ description = "Pet found" ,
90
90
content = @ Content (mediaType = "application/json" ,
91
91
schema = @ Schema (type = SchemaType .OBJECT , implementation = Pet .class ,
92
92
oneOf = {
@@ -150,7 +150,7 @@ public void write(OutputStream output) throws IOException {
150
150
public Response deletePet (
151
151
@ Parameter (name = "apiKey" , description = "authentication key to access this method" ,
152
152
schema = @ Schema (type = SchemaType .STRING , implementation = String .class , maxLength = 256 ,
153
- minLength = 32 )) @ HeaderParam ("api_key " ) String apiKey ,
153
+ minLength = 32 )) @ HeaderParam ("apiKey " ) String apiKey ,
154
154
@ Parameter (name = "petId" , description = "ID of pet that needs to be fetched" , required = true ,
155
155
schema = @ Schema (implementation = Long .class , maximum = "10" ,
156
156
minimum = "1" )) @ PathParam ("petId" ) Long petId ) {
@@ -191,37 +191,13 @@ public Response addPet(Pet pet) {
191
191
})
192
192
@ Operation (summary = "Update an existing pet" , description = "Update an existing pet with the given new attributes" )
193
193
public Response updatePet (
194
- @ Parameter (name = "petAttribute" , description = "Attribute to update existing pet record" , required = true ,
195
- schema = @ Schema (implementation = Pet .class )) Pet pet ) {
194
+ @ RequestBody (description = "Attribute to update existing pet record" ,
195
+ required = true ,
196
+ content = @ Content (schema = @ Schema (implementation = Pet .class ))) Pet pet ) {
196
197
Pet updatedPet = petData .addPet (pet );
197
198
return Response .ok ().entity (updatedPet ).build ();
198
199
}
199
200
200
- @ GET
201
- @ Path ("/findByStatus" )
202
- @ APIResponse (responseCode = "400" , description = "Invalid status value" , content = @ Content (mediaType = "none" ))
203
- @ APIResponse (responseCode = "200" ,
204
- content = @ Content (mediaType = "application/json" ,
205
- schema = @ Schema (type = SchemaType .ARRAY , implementation = Pet .class )))
206
- @ Operation (summary = "Finds Pets by status" ,
207
- description = "Find all the Pets with the given status; Multiple status values can be provided with comma seperated strings" )
208
- @ Extension (name = "x-mp-method1" , value = "true" )
209
- @ Extensions ({@ Extension (name = "x-mp-method2" , value = "true" ), @ Extension (value = "false" , name = "x-mp-method3" )})
210
- public Response findPetsByStatus (
211
- @ Parameter (name = "status" , description = "Status values that need to be considered for filter" ,
212
- required = true , schema = @ Schema (implementation = String .class ), content = {
213
- @ Content (examples = {
214
- @ ExampleObject (name = "Available" , value = "available" ,
215
- summary = "Retrieves all the pets that are available" ),
216
- @ ExampleObject (name = "Pending" , value = "pending" ,
217
- summary = "Retrieves all the pets that are pending to be sold" ),
218
- @ ExampleObject (name = "Sold" , value = "sold" ,
219
- summary = "Retrieves all the pets that are sold" )
220
- })
221
- }, allowEmptyValue = true ) @ Extension (name = "x-mp-parm1" , value = "true" ) String status ) {
222
- return Response .ok (petData .findPetByStatus (status )).build ();
223
- }
224
-
225
201
@ GET
226
202
@ Path ("/findByTags" )
227
203
@ Produces ("application/json" )
@@ -233,6 +209,7 @@ public Response findPetsByStatus(
233
209
description = "Invalid tag value" ,
234
210
content = @ Content (mediaType = "none" )),
235
211
@ APIResponse (responseCode = "200" ,
212
+ description = "Pet callback successfully processed" ,
236
213
content = @ Content (mediaType = "application/json" ,
237
214
schema = @ Schema (type = SchemaType .ARRAY ,
238
215
implementation = Pet .class )))
0 commit comments