[jax-rs][jersey3] Fix missing SecurityRequirement (#17797)

* [jax-rs][jersey3] Add SecurityRequirement

* Update Samples

* update samples

---------

Co-authored-by: nbreuil <88213872+nbreuil@users.noreply.github.com>
This commit is contained in:
William Cheng 2024-02-06 16:47:19 +08:00 committed by GitHub
parent 6e137bb61d
commit 5af2c7fbfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 55 additions and 15 deletions

View File

@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
{{#imports}}import {{import}}; {{#imports}}import {{import}};
@ -79,7 +80,11 @@ public class {{classname}} {
@ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}", content = @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}", content =
@Content(schema = @Schema(implementation = {{{baseType}}}.class))), @Content(schema = @Schema(implementation = {{{baseType}}}.class))),
{{/responses}} {{/responses}}
}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) }{{#hasAuthMethods}},security = {
{{#authMethods}}
@SecurityRequirement(name = "{{name}}"{{#scopes.0}}, scopes={ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} }{{/scopes.0}}){{^-last}},{{/-last}}
{{/authMethods}}
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} })
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext); return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext);

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.openapitools.model.Client; import org.openapitools.model.Client;

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -104,7 +105,9 @@ public class FakeApi {
@Operation(summary = "test http signature authentication", description = "", responses = { @Operation(summary = "test http signature authentication", description = "", responses = {
@ApiResponse(responseCode = "200", description = "The instance started successfully", content = @ApiResponse(responseCode = "200", description = "The instance started successfully", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "fake", }) },security = {
@SecurityRequirement(name = "http_signature_test")
}, tags={ "fake", })
public Response fakeHttpSignatureTest(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Schema(description = "query parameter") @QueryParam("query_1") String query1,@Schema(description = "header parameter" )@HeaderParam("header_1") String header1,@Context SecurityContext securityContext) public Response fakeHttpSignatureTest(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Schema(description = "query parameter") @QueryParam("query_1") String query1,@Schema(description = "header parameter" )@HeaderParam("header_1") String header1,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.fakeHttpSignatureTest(pet, query1, header1, securityContext); return delegate.fakeHttpSignatureTest(pet, query1, header1, securityContext);
@ -242,7 +245,9 @@ public class FakeApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "404", description = "User not found", content = @ApiResponse(responseCode = "404", description = "User not found", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "fake", }) },security = {
@SecurityRequirement(name = "http_basic_test")
}, tags={ "fake", })
public Response testEndpointParameters(@Schema(description = "None") @QueryParam("number") BigDecimal number,@Schema(description = "None") @QueryParam("double") Double _double,@Schema(description = "None") @QueryParam("pattern_without_delimiter") String patternWithoutDelimiter,@Schema(description = "None") @QueryParam("byte") byte[] _byte,@Schema(description = "None") @QueryParam("integer") Integer integer,@Schema(description = "None") @QueryParam("int32") Integer int32,@Schema(description = "None") @QueryParam("int64") Long int64,@Schema(description = "None") @QueryParam("float") Float _float,@Schema(description = "None") @QueryParam("string") String string,@FormDataParam("binary") FormDataBodyPart binaryBodypart,@Schema(description = "None") @QueryParam("date") Date date,@Schema(description = "None") @QueryParam("dateTime") Date dateTime,@Schema(description = "None") @QueryParam("password") String password,@Schema(description = "None") @QueryParam("callback") String paramCallback,@Context SecurityContext securityContext) public Response testEndpointParameters(@Schema(description = "None") @QueryParam("number") BigDecimal number,@Schema(description = "None") @QueryParam("double") Double _double,@Schema(description = "None") @QueryParam("pattern_without_delimiter") String patternWithoutDelimiter,@Schema(description = "None") @QueryParam("byte") byte[] _byte,@Schema(description = "None") @QueryParam("integer") Integer integer,@Schema(description = "None") @QueryParam("int32") Integer int32,@Schema(description = "None") @QueryParam("int64") Long int64,@Schema(description = "None") @QueryParam("float") Float _float,@Schema(description = "None") @QueryParam("string") String string,@FormDataParam("binary") FormDataBodyPart binaryBodypart,@Schema(description = "None") @QueryParam("date") Date date,@Schema(description = "None") @QueryParam("dateTime") Date dateTime,@Schema(description = "None") @QueryParam("password") String password,@Schema(description = "None") @QueryParam("callback") String paramCallback,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binaryBodypart, date, dateTime, password, paramCallback, securityContext); return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binaryBodypart, date, dateTime, password, paramCallback, securityContext);
@ -265,7 +270,9 @@ public class FakeApi {
@Operation(summary = "Fake endpoint to test group parameters (optional)", description = "", responses = { @Operation(summary = "Fake endpoint to test group parameters (optional)", description = "", responses = {
@ApiResponse(responseCode = "400", description = "Something wrong", content = @ApiResponse(responseCode = "400", description = "Something wrong", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "fake", }) },security = {
@SecurityRequirement(name = "bearer_test")
}, tags={ "fake", })
public Response testGroupParameters(@Schema(description = "Required String in group parameters") @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@Schema(description = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@Schema(description = "Required Integer in group parameters") @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@Schema(description = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@Schema(description = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@Schema(description = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) public Response testGroupParameters(@Schema(description = "Required String in group parameters") @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@Schema(description = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@Schema(description = "Required Integer in group parameters") @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@Schema(description = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@Schema(description = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@Schema(description = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext);
@ -349,7 +356,9 @@ public class FakeApi {
@Operation(summary = "uploads an image (required)", description = "", responses = { @Operation(summary = "uploads an image (required)", description = "", responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @ApiResponse(responseCode = "200", description = "successful operation", content =
@Content(schema = @Schema(implementation = ModelApiResponse.class))), @Content(schema = @Schema(implementation = ModelApiResponse.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response uploadFileWithRequiredFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) public Response uploadFileWithRequiredFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.uploadFileWithRequiredFile(petId, requiredFileBodypart, additionalMetadata, securityContext); return delegate.uploadFileWithRequiredFile(petId, requiredFileBodypart, additionalMetadata, securityContext);

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.openapitools.model.Client; import org.openapitools.model.Client;
@ -65,7 +66,9 @@ public class FakeClassnameTestApi {
@Operation(summary = "To test class name in snake case", description = "", responses = { @Operation(summary = "To test class name in snake case", description = "", responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @ApiResponse(responseCode = "200", description = "successful operation", content =
@Content(schema = @Schema(implementation = Client.class))), @Content(schema = @Schema(implementation = Client.class))),
}, tags={ "fake_classname_tags 123#$%^", }) },security = {
@SecurityRequirement(name = "api_key_query")
}, tags={ "fake_classname_tags 123#$%^", })
public Response testClassname(@Schema(description = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) public Response testClassname(@Schema(description = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.testClassname(client, securityContext); return delegate.testClassname(client, securityContext);

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.openapitools.model.FooGetDefaultResponse; import org.openapitools.model.FooGetDefaultResponse;

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.File; import java.io.File;
@ -69,7 +70,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "405", description = "Invalid input", content = @ApiResponse(responseCode = "405", description = "Invalid input", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response addPet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) public Response addPet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.addPet(pet, securityContext); return delegate.addPet(pet, securityContext);
@ -82,7 +85,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "400", description = "Invalid pet value", content = @ApiResponse(responseCode = "400", description = "Invalid pet value", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response deletePet(@Schema(description= "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) public Response deletePet(@Schema(description= "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deletePet(petId, apiKey, securityContext); return delegate.deletePet(petId, apiKey, securityContext);
@ -96,7 +101,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Pet.class))), @Content(schema = @Schema(implementation = Pet.class))),
@ApiResponse(responseCode = "400", description = "Invalid status value", content = @ApiResponse(responseCode = "400", description = "Invalid status value", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response findPetsByStatus(@Schema(description = "Status values that need to be considered for filter") @QueryParam("status") @NotNull @Valid List<String> status,@Context SecurityContext securityContext) public Response findPetsByStatus(@Schema(description = "Status values that need to be considered for filter") @QueryParam("status") @NotNull @Valid List<String> status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByStatus(status, securityContext); return delegate.findPetsByStatus(status, securityContext);
@ -110,7 +117,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Pet.class))), @Content(schema = @Schema(implementation = Pet.class))),
@ApiResponse(responseCode = "400", description = "Invalid tag value", content = @ApiResponse(responseCode = "400", description = "Invalid tag value", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response findPetsByTags(@Schema(description = "Tags to filter by") @QueryParam("tags") @NotNull @Valid Set<String> tags,@Context SecurityContext securityContext) public Response findPetsByTags(@Schema(description = "Tags to filter by") @QueryParam("tags") @NotNull @Valid Set<String> tags,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByTags(tags, securityContext); return delegate.findPetsByTags(tags, securityContext);
@ -126,7 +135,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "404", description = "Pet not found", content = @ApiResponse(responseCode = "404", description = "Pet not found", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "api_key")
}, tags={ "pet", })
public Response getPetById(@Schema(description= "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) public Response getPetById(@Schema(description= "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getPetById(petId, securityContext); return delegate.getPetById(petId, securityContext);
@ -143,7 +154,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "405", description = "Validation exception", content = @ApiResponse(responseCode = "405", description = "Validation exception", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response updatePet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) public Response updatePet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePet(pet, securityContext); return delegate.updatePet(pet, securityContext);
@ -157,7 +170,9 @@ public class PetApi {
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "405", description = "Invalid input", content = @ApiResponse(responseCode = "405", description = "Invalid input", content =
@Content(schema = @Schema(implementation = Void.class))), @Content(schema = @Schema(implementation = Void.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response updatePetWithForm(@Schema(description= "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Updated name of the pet") @QueryParam("name") String name,@Schema(description = "Updated status of the pet") @QueryParam("status") String status,@Context SecurityContext securityContext) public Response updatePetWithForm(@Schema(description= "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Updated name of the pet") @QueryParam("name") String name,@Schema(description = "Updated status of the pet") @QueryParam("status") String status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePetWithForm(petId, name, status, securityContext); return delegate.updatePetWithForm(petId, name, status, securityContext);
@ -170,7 +185,9 @@ public class PetApi {
@Operation(summary = "uploads an image", description = "", responses = { @Operation(summary = "uploads an image", description = "", responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @ApiResponse(responseCode = "200", description = "successful operation", content =
@Content(schema = @Schema(implementation = ModelApiResponse.class))), @Content(schema = @Schema(implementation = ModelApiResponse.class))),
}, tags={ "pet", }) },security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" })
}, tags={ "pet", })
public Response uploadFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@FormDataParam("file") FormDataBodyPart _fileBodypart,@Context SecurityContext securityContext) public Response uploadFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@FormDataParam("file") FormDataBodyPart _fileBodypart,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.uploadFile(petId, additionalMetadata, _fileBodypart, securityContext); return delegate.uploadFile(petId, additionalMetadata, _fileBodypart, securityContext);

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Map; import java.util.Map;
@ -79,7 +80,9 @@ public class StoreApi {
@Operation(summary = "Returns pet inventories by status", description = "", responses = { @Operation(summary = "Returns pet inventories by status", description = "", responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @ApiResponse(responseCode = "200", description = "successful operation", content =
@Content(schema = @Schema(implementation = Map.class))), @Content(schema = @Schema(implementation = Map.class))),
}, tags={ "store", }) },security = {
@SecurityRequirement(name = "api_key")
}, tags={ "store", })
public Response getInventory(@Context SecurityContext securityContext) public Response getInventory(@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getInventory(securityContext); return delegate.getInventory(securityContext);

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Date; import java.util.Date;