Class OpenApiProcessor
java.lang.Object
com.mohamnag.jstatic.plugins.openapi_processor.OpenApiProcessor
- All Implemented Interfaces:
BuildTask
Expands any page found with OpenAPI raw spec in its data, into pages under sub-nodes generated out of spec's
components tag (i.e. responses, request bodies, schemas, ...).
Puts an object of type
OpenApiContext
in page's parent under key
"openApiContext" in order for helpers to have access to spec's
information using recursive data access.
Each component of the discovered spec will result in generation of one page. The package configured for each type of
component as specified by OpenApiProcessorConfig.getPackageName(ComponentType)
, will be used to determine
which node to put each component's page under. This can even be multiple levels, for example a package config
"dtos.request_bodies"
for request body components will result in a node called dtos
as
sibling of where the OpenAPI data were found and a second node called request_bodies
under it. Each
component of type request body will have a page under these.
Each generated page will be added one Component
under
key "component" which contains spec's component data. A key "template" will
be also set based on component type and configured template names as per
OpenApiProcessorConfig.getTemplate(ComponentType)
so that
HandlebarsTemplateCompilerTask
picks up and
processes it.
Currently, supports OpenAPI rawSpec v3.0.x-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
run
(BuildContext buildContext) If a plugin depends on config files in addition to the general config file of the application, like functionality extensions stored in files, it shall return these paths here.If a plugin depends on file input, it shall return list of its input paths to be watched for changes.
-
Field Details
-
PAGE_DATA_KEY_COMPONENT
- See Also:
-
PAGE_DATA_KEY_TEMPLATE
- See Also:
-
-
Constructor Details
-
OpenApiProcessor
-
-
Method Details
-
run
-
underWatchInputPaths
Description copied from interface:BuildTask
If a plugin depends on file input, it shall return list of its input paths to be watched for changes. Paths can be either files or directories. In case of directories, only root path are necessary to be listed and if input path has subdirectories, they will be automatically watched.- Specified by:
underWatchInputPaths
in interfaceBuildTask
-
underWatchConfigPaths
Description copied from interface:BuildTask
If a plugin depends on config files in addition to the general config file of the application, like functionality extensions stored in files, it shall return these paths here. A change detected in these paths will result in recreation of the plugin.- Specified by:
underWatchConfigPaths
in interfaceBuildTask
-