Package io.jmix.rest.impl.openapi
Class OpenAPIGeneratorImpl
java.lang.Object
io.jmix.rest.impl.openapi.OpenAPIGeneratorImpl
- All Implemented Interfaces:
OpenAPIGenerator
@Component("rest_OpenAPIGenerator")
public class OpenAPIGeneratorImpl
extends Object
implements OpenAPIGenerator
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected CorePropertiesprotected static final Stringprotected static final Stringprotected static final Stringprotected Metadataprotected MetadataToolsprotected io.swagger.v3.oas.models.OpenAPIprotected RestQueriesConfigurationprotected static final Stringprotected static final Stringprotected Resourcesprotected RestPropertiesprotected static final Stringprotected static final Stringprotected RestServicesConfigurationprotected jakarta.servlet.ServletContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildEntitiesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidbuildEntityFilterPaths(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass) protected voidbuildEntityPath(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass) protected voidbuildEntityRUDPaths(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass) protected voidbuildEntitySchema(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidbuildErrorSchema(io.swagger.v3.oas.models.OpenAPI openAPI) protected voidbuildInfo(io.swagger.v3.oas.models.OpenAPI openAPI) protected voidbuildQueriesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidbuildReferencedEntitySchemas(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidbuildServer(io.swagger.v3.oas.models.OpenAPI openAPI) protected voidbuildServicesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidbuildTags(io.swagger.v3.oas.models.OpenAPI openAPI) protected voidprotected io.swagger.v3.oas.models.responses.ApiResponsecreateEntityArrayResponse(String msg, String entityName) protected io.swagger.v3.oas.models.OperationcreateEntityBrowseOperation(MetaClass entityClass) protected io.swagger.v3.oas.models.media.ContentcreateEntityContent(String entityName) protected io.swagger.v3.oas.models.OperationcreateEntityCreateOperation(MetaClass entityClass) protected io.swagger.v3.oas.models.OperationcreateEntityDeleteOperation(MetaClass entityClass) protected List<io.swagger.v3.oas.models.parameters.Parameter>createEntityOptionalParams(boolean singleEntityOperation) protected io.swagger.v3.oas.models.OperationcreateEntityReadOperation(MetaClass entityClass) protected io.swagger.v3.oas.models.responses.ApiResponsecreateEntityResponse(String msg, String entityName) protected io.swagger.v3.oas.models.OperationcreateEntitySearchOperation(MetaClass entityClass, org.springframework.web.bind.annotation.RequestMethod method) protected io.swagger.v3.oas.models.OperationcreateEntityUpdateOperation(MetaClass entityClass) protected io.swagger.v3.oas.models.responses.ApiResponseprotected io.swagger.v3.oas.models.parameters.ParametercreateGetOperationParam(String parameterName, String parameterType) protected List<io.swagger.v3.oas.models.parameters.Parameter>protected io.swagger.v3.oas.models.OperationcreateQueryCountOperation(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected io.swagger.v3.oas.models.OperationcreateQueryOperation(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected List<io.swagger.v3.oas.models.parameters.Parameter>createQueryOpParams(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, boolean generateOptionalParams) protected io.swagger.v3.oas.models.parameters.RequestBodycreateQueryRequestBody(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected io.swagger.v3.oas.models.OperationcreateServiceMethodOp(String service, RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod requestMethod, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected List<io.swagger.v3.oas.models.parameters.Parameter>createServiceMethodParams(RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod requestMethod) protected io.swagger.v3.oas.models.parameters.RequestBodycreateServiceMethodRequestBody(RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) io.swagger.v3.oas.models.OpenAPIprotected StringgetEntitySchemaName(String entityName) protected StringgetEntitySchemaRef(String entityName) protected Stringprotected io.swagger.v3.oas.models.media.Schema<?>getNamePatternProperty(MetaClass entityClass) protected io.swagger.v3.oas.models.media.Schema<?>getObjectProperty(String classFqn, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected io.swagger.v3.oas.models.media.Schema<?>getPrimitiveProperty(String type) protected io.swagger.v3.oas.models.media.Schema<?>getPropertyFromJavaType(String type, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) protected voidinit()
-
Field Details
-
ENTITY_PATH
- See Also:
-
ENTITY_RUD_OPS
- See Also:
-
ENTITY_SEARCH
- See Also:
-
QUERY_PATH
- See Also:
-
QUERY_COUNT_PATH
- See Also:
-
SERVICE_PATH
- See Also:
-
SCHEMAS_PREFIX
- See Also:
-
ARRAY_SIGNATURE
- See Also:
-
coreProperties
-
servletContext
@Autowired(required=false) protected jakarta.servlet.ServletContext servletContext -
resources
-
metadata
-
metadataTools
-
queriesConfiguration
-
servicesConfiguration
-
restProperties
-
openAPI
protected io.swagger.v3.oas.models.OpenAPI openAPI
-
-
Constructor Details
-
OpenAPIGeneratorImpl
public OpenAPIGeneratorImpl()
-
-
Method Details
-
generateOpenAPI
public io.swagger.v3.oas.models.OpenAPI generateOpenAPI()- Specified by:
generateOpenAPIin interfaceOpenAPIGenerator- Returns:
- a
OpenAPIobject that can be transformed to JSON or YAML version of documentation
-
checkInitialized
protected void checkInitialized() -
init
protected void init() -
buildReferencedEntitySchemas
protected void buildReferencedEntitySchemas(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
buildServer
protected void buildServer(io.swagger.v3.oas.models.OpenAPI openAPI) -
buildInfo
protected void buildInfo(io.swagger.v3.oas.models.OpenAPI openAPI) -
buildErrorSchema
protected void buildErrorSchema(io.swagger.v3.oas.models.OpenAPI openAPI) -
buildTags
protected void buildTags(io.swagger.v3.oas.models.OpenAPI openAPI) -
buildEntitiesPaths
protected void buildEntitiesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
buildEntitySchema
protected void buildEntitySchema(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
buildEntityPath
-
buildEntityRUDPaths
-
buildEntityFilterPaths
protected void buildEntityFilterPaths(io.swagger.v3.oas.models.OpenAPI openAPI, MetaClass entityClass) -
createEntityCreateOperation
-
createEntityBrowseOperation
-
createEntityReadOperation
-
createEntityUpdateOperation
-
createEntityDeleteOperation
-
createEntitySearchOperation
protected io.swagger.v3.oas.models.Operation createEntitySearchOperation(MetaClass entityClass, org.springframework.web.bind.annotation.RequestMethod method) -
createEntityOptionalParams
protected List<io.swagger.v3.oas.models.parameters.Parameter> createEntityOptionalParams(boolean singleEntityOperation) -
getNamePatternProperty
-
buildServicesPaths
protected void buildServicesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createServiceMethodOp
protected io.swagger.v3.oas.models.Operation createServiceMethodOp(String service, RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod requestMethod, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createServiceMethodParams
protected List<io.swagger.v3.oas.models.parameters.Parameter> createServiceMethodParams(RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod requestMethod) -
createServiceMethodRequestBody
@Nullable protected io.swagger.v3.oas.models.parameters.RequestBody createServiceMethodRequestBody(RestServicesConfiguration.RestMethodInfo methodInfo, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
buildQueriesPaths
protected void buildQueriesPaths(io.swagger.v3.oas.models.OpenAPI openAPI, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createQueryOperation
protected io.swagger.v3.oas.models.Operation createQueryOperation(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createQueryCountOperation
protected io.swagger.v3.oas.models.Operation createQueryCountOperation(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createQueryOpParams
protected List<io.swagger.v3.oas.models.parameters.Parameter> createQueryOpParams(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, boolean generateOptionalParams) -
createOptionalQueryParams
-
createQueryRequestBody
@Nullable protected io.swagger.v3.oas.models.parameters.RequestBody createQueryRequestBody(RestQueriesConfiguration.QueryInfo query, org.springframework.web.bind.annotation.RequestMethod method, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
createGetOperationParam
-
getPropertyFromJavaType
protected io.swagger.v3.oas.models.media.Schema<?> getPropertyFromJavaType(String type, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
getObjectProperty
@Nullable protected io.swagger.v3.oas.models.media.Schema<?> getObjectProperty(String classFqn, OpenAPIGeneratorImpl.SchemaBuildContext schemaBuildContext) -
getPrimitiveProperty
-
createErrorResponse
-
createEntityResponse
-
createEntityArrayResponse
-
createEntityContent
-
getEntitySchemaName
-
getEntitySchemaRef
-
getErrorSchemaRef
-