Swagger common strings refactoring

This commit is contained in:
Thomas Georgios Giannos 2024-07-08 13:33:08 +03:00
parent fe26af8055
commit d44d420763
12 changed files with 72 additions and 52 deletions

View File

@ -165,8 +165,8 @@ public class DescriptionController {
@OperationWithTenantHeader(summary = "Query all descriptions", description = SwaggerHelpers.Description.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Description.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all descriptions", description = SwaggerHelpers.Description.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Description.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Description.endpoint_query_request_body_example value = SwaggerHelpers.Description.endpoint_query_request_body_example
) )
} }
@ -177,8 +177,8 @@ public class DescriptionController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Description.endpoint_query_response_example value = SwaggerHelpers.Description.endpoint_query_response_example
)))) ))))
public QueryResult<Description> query(@RequestBody DescriptionLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<Description> query(@RequestBody DescriptionLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -101,8 +101,8 @@ public class DescriptionTemplateController {
@OperationWithTenantHeader(summary = "Query all description templates", description = SwaggerHelpers.DescriptionTemplate.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all description templates", description = SwaggerHelpers.DescriptionTemplate.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body_example value = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body_example
) )
} }
@ -113,8 +113,8 @@ public class DescriptionTemplateController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.DescriptionTemplate.endpoint_query_response_example value = SwaggerHelpers.DescriptionTemplate.endpoint_query_response_example
)))) ))))
public QueryResult<DescriptionTemplate> query(@RequestBody DescriptionTemplateLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<DescriptionTemplate> query(@RequestBody DescriptionTemplateLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -82,8 +82,8 @@ public class DescriptionTemplateTypeController {
@OperationWithTenantHeader(summary = "Query all description template types", description = SwaggerHelpers.DescriptionTemplateType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all description template types", description = SwaggerHelpers.DescriptionTemplateType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body_example value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body_example
) )
} }
@ -94,8 +94,8 @@ public class DescriptionTemplateTypeController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_response_example value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_response_example
)))) ))))
public QueryResult<DescriptionTemplateType> Query(@RequestBody DescriptionTemplateTypeLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<DescriptionTemplateType> Query(@RequestBody DescriptionTemplateTypeLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -82,8 +82,8 @@ public class EntityDoiController {
@OperationWithTenantHeader(summary = "Query all entity dois", description = SwaggerHelpers.EntityDoi.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.EntityDoi.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all entity dois", description = SwaggerHelpers.EntityDoi.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.EntityDoi.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.EntityDoi.endpoint_query_request_body_example value = SwaggerHelpers.EntityDoi.endpoint_query_request_body_example
) )
} }
@ -94,8 +94,8 @@ public class EntityDoiController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.EntityDoi.endpoint_query_response_example value = SwaggerHelpers.EntityDoi.endpoint_query_response_example
)))) ))))
public QueryResult<EntityDoi> query(@RequestBody EntityDoiLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<EntityDoi> query(@RequestBody EntityDoiLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -105,8 +105,8 @@ public class LockController {
@OperationWithTenantHeader(summary = "Query all locked entities", description = SwaggerHelpers.Lock.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Lock.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all locked entities", description = SwaggerHelpers.Lock.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Lock.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Lock.endpoint_query_request_body_example value = SwaggerHelpers.Lock.endpoint_query_request_body_example
) )
} }
@ -117,8 +117,8 @@ public class LockController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Lock.endpoint_query_response_example value = SwaggerHelpers.Lock.endpoint_query_response_example
)))) ))))
public QueryResult<Lock> query(@RequestBody LockLookup lookup) throws MyApplicationException, MyForbiddenException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { public QueryResult<Lock> query(@RequestBody LockLookup lookup) throws MyApplicationException, MyForbiddenException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {

View File

@ -94,8 +94,8 @@ public class PlanBlueprintController {
@OperationWithTenantHeader(summary = "Query all plan blueprints", description = SwaggerHelpers.PlanBlueprint.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all plan blueprints", description = SwaggerHelpers.PlanBlueprint.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body_example value = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body_example
) )
} }
@ -106,8 +106,8 @@ public class PlanBlueprintController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.PlanBlueprint.endpoint_query_response_example value = SwaggerHelpers.PlanBlueprint.endpoint_query_response_example
)))) ))))
public QueryResult<PlanBlueprint> query(@RequestBody PlanBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<PlanBlueprint> query(@RequestBody PlanBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -147,8 +147,8 @@ public class PlanController {
@PostMapping("query") @PostMapping("query")
@OperationWithTenantHeader(summary = "Query all plans", description = SwaggerHelpers.Plan.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Plan.endpoint_query_request_body, content = @Content(examples = @ExampleObject( @OperationWithTenantHeader(summary = "Query all plans", description = SwaggerHelpers.Plan.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Plan.endpoint_query_request_body, content = @Content(examples = @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Plan.endpoint_query_request_body_example value = SwaggerHelpers.Plan.endpoint_query_request_body_example
))), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( ))), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content(
array = @ArraySchema( array = @ArraySchema(
@ -157,8 +157,8 @@ public class PlanController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Plan.endpoint_query_response_example value = SwaggerHelpers.Plan.endpoint_query_response_example
)))) ))))
public QueryResult<Plan> Query(@RequestBody PlanLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<Plan> Query(@RequestBody PlanLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -92,8 +92,8 @@ public class ReferenceController {
@OperationWithTenantHeader(summary = "Query all references", description = SwaggerHelpers.Reference.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all references", description = SwaggerHelpers.Reference.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Reference.endpoint_query_request_body_example value = SwaggerHelpers.Reference.endpoint_query_request_body_example
) )
} }
@ -104,8 +104,8 @@ public class ReferenceController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Reference.endpoint_query_response_example value = SwaggerHelpers.Reference.endpoint_query_response_example
)))) ))))
public QueryResult<Reference> query(@RequestBody ReferenceLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<Reference> query(@RequestBody ReferenceLookup lookup) throws MyApplicationException, MyForbiddenException {
@ -127,8 +127,8 @@ public class ReferenceController {
@OperationWithTenantHeader(summary = "Query all references including results from external APIs", description = SwaggerHelpers.Reference.endpoint_search, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_search_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all references including results from external APIs", description = SwaggerHelpers.Reference.endpoint_search, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_search_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Reference.endpoint_search_request_body_example value = SwaggerHelpers.Reference.endpoint_search_request_body_example
) )
} }
@ -139,8 +139,8 @@ public class ReferenceController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Reference.endpoint_search_response_example value = SwaggerHelpers.Reference.endpoint_search_response_example
)))) ))))
@Swagger404 @Swagger404

View File

@ -94,8 +94,8 @@ public class ReferenceTypeController{
@OperationWithTenantHeader(summary = "Query all reference types", description = SwaggerHelpers.ReferenceType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.ReferenceType.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all reference types", description = SwaggerHelpers.ReferenceType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.ReferenceType.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.ReferenceType.endpoint_query_request_body_example value = SwaggerHelpers.ReferenceType.endpoint_query_request_body_example
) )
} }
@ -106,8 +106,8 @@ public class ReferenceTypeController{
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.ReferenceType.endpoint_query_response_example value = SwaggerHelpers.ReferenceType.endpoint_query_response_example
)))) ))))
public QueryResult<ReferenceType> query(@RequestBody ReferenceTypeLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<ReferenceType> query(@RequestBody ReferenceTypeLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -81,8 +81,8 @@ public class TagController {
@OperationWithTenantHeader(summary = "Query all tags", description = SwaggerHelpers.Tag.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Tag.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all tags", description = SwaggerHelpers.Tag.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Tag.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.Tag.endpoint_query_request_body_example value = SwaggerHelpers.Tag.endpoint_query_request_body_example
) )
} }
@ -93,8 +93,8 @@ public class TagController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.Tag.endpoint_query_response_example value = SwaggerHelpers.Tag.endpoint_query_response_example
)))) ))))
public QueryResult<Tag> Query(@RequestBody TagLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<Tag> Query(@RequestBody TagLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -111,8 +111,8 @@ public class UserController {
@OperationWithTenantHeader(summary = "Query all users", description = SwaggerHelpers.User.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all users", description = SwaggerHelpers.User.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.User.endpoint_query_request_body_example value = SwaggerHelpers.User.endpoint_query_request_body_example
) )
} }
@ -123,8 +123,8 @@ public class UserController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.User.endpoint_query_response_example value = SwaggerHelpers.User.endpoint_query_response_example
)))) ))))
public QueryResult<User> query(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<User> query(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException {
@ -147,8 +147,8 @@ public class UserController {
@OperationWithTenantHeader(summary = "Query all plan associated users", description = SwaggerHelpers.User.endpoint_query_plan_associated, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all plan associated users", description = SwaggerHelpers.User.endpoint_query_plan_associated, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content(
examples = { examples = {
@ExampleObject( @ExampleObject(
name = "Pagination and projection", name = SwaggerHelpers.Commons.pagination_example,
description = "Simple paginated request using a property projection list and pagination info", description = SwaggerHelpers.Commons.pagination_example_description,
value = SwaggerHelpers.User.endpoint_query_plan_associated_request_body_example value = SwaggerHelpers.User.endpoint_query_plan_associated_request_body_example
) )
} }
@ -159,8 +159,8 @@ public class UserController {
) )
), ),
examples = @ExampleObject( examples = @ExampleObject(
name = "First page", name = SwaggerHelpers.Commons.pagination_response_example,
description = "Example with the first page of paginated results", description = SwaggerHelpers.Commons.pagination_response_example_description,
value = SwaggerHelpers.User.endpoint_query_plan_associated_response_example value = SwaggerHelpers.User.endpoint_query_plan_associated_response_example
)))) ))))
public QueryResult<PlanAssociatedUser> queryPlanAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { public QueryResult<PlanAssociatedUser> queryPlanAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException {

View File

@ -8,6 +8,26 @@ public final class SwaggerHelpers {
""" """
This is an object containing a list of the properties you wish to include in the response, similar to the 'project' attribute on queries. This is an object containing a list of the properties you wish to include in the response, similar to the 'project' attribute on queries.
"""; """;
public static final String pagination_example =
"""
Pagination and projection
""";
public static final String pagination_example_description =
"""
Simple paginated request using a property projection list and pagination info
""";
public static final String pagination_response_example =
"""
Pagination and projection
""";
public static final String pagination_response_example_description =
"""
Simple paginated request using a property projection list and pagination info
""";
} }
public static final class Errors { public static final class Errors {