forked from loafle/openapi-generator-original
[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:
parent
6e137bb61d
commit
5af2c7fbfb
@ -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.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
@ -79,7 +80,11 @@ public class {{classname}} {
|
||||
@ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}", content =
|
||||
@Content(schema = @Schema(implementation = {{{baseType}}}.class))),
|
||||
{{/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)
|
||||
throws NotFoundException {
|
||||
return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext);
|
||||
|
@ -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.Schema;
|
||||
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 org.openapitools.model.Client;
|
||||
|
@ -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.Schema;
|
||||
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 java.math.BigDecimal;
|
||||
@ -104,7 +105,9 @@ public class FakeApi {
|
||||
@Operation(summary = "test http signature authentication", description = "", responses = {
|
||||
@ApiResponse(responseCode = "200", description = "The instance started successfully", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.fakeHttpSignatureTest(pet, query1, header1, securityContext);
|
||||
@ -242,7 +245,9 @@ public class FakeApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "404", description = "User not found", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
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 = {
|
||||
@ApiResponse(responseCode = "400", description = "Something wrong", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
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 = {
|
||||
@ApiResponse(responseCode = "200", description = "successful operation", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId, requiredFileBodypart, additionalMetadata, securityContext);
|
||||
|
@ -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.Schema;
|
||||
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 org.openapitools.model.Client;
|
||||
@ -65,7 +66,9 @@ public class FakeClassnameTestApi {
|
||||
@Operation(summary = "To test class name in snake case", description = "", responses = {
|
||||
@ApiResponse(responseCode = "200", description = "successful operation", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.testClassname(client, securityContext);
|
||||
|
@ -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.Schema;
|
||||
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 org.openapitools.model.FooGetDefaultResponse;
|
||||
|
@ -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.Schema;
|
||||
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 java.io.File;
|
||||
@ -69,7 +70,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "405", description = "Invalid input", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.addPet(pet, securityContext);
|
||||
@ -82,7 +85,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "400", description = "Invalid pet value", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.deletePet(petId, apiKey, securityContext);
|
||||
@ -96,7 +101,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Pet.class))),
|
||||
@ApiResponse(responseCode = "400", description = "Invalid status value", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status, securityContext);
|
||||
@ -110,7 +117,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Pet.class))),
|
||||
@ApiResponse(responseCode = "400", description = "Invalid tag value", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags, securityContext);
|
||||
@ -126,7 +135,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "404", description = "Pet not found", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetById(petId, securityContext);
|
||||
@ -143,7 +154,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "405", description = "Validation exception", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePet(pet, securityContext);
|
||||
@ -157,7 +170,9 @@ public class PetApi {
|
||||
@Content(schema = @Schema(implementation = Void.class))),
|
||||
@ApiResponse(responseCode = "405", description = "Invalid input", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePetWithForm(petId, name, status, securityContext);
|
||||
@ -170,7 +185,9 @@ public class PetApi {
|
||||
@Operation(summary = "uploads an image", description = "", responses = {
|
||||
@ApiResponse(responseCode = "200", description = "successful operation", content =
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId, additionalMetadata, _fileBodypart, securityContext);
|
||||
|
@ -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.Schema;
|
||||
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 java.util.Map;
|
||||
@ -79,7 +80,9 @@ public class StoreApi {
|
||||
@Operation(summary = "Returns pet inventories by status", description = "", responses = {
|
||||
@ApiResponse(responseCode = "200", description = "successful operation", content =
|
||||
@Content(schema = @Schema(implementation = Map.class))),
|
||||
}, tags={ "store", })
|
||||
},security = {
|
||||
@SecurityRequirement(name = "api_key")
|
||||
}, tags={ "store", })
|
||||
public Response getInventory(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getInventory(securityContext);
|
||||
|
@ -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.Schema;
|
||||
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 java.util.Date;
|
||||
|
Loading…
x
Reference in New Issue
Block a user