Processor Reference โ
This page is generated automatically from the swagger-php sources.
For improvements head over to GitHub and create a PR ๐
Processors are listed in the default order of execution.
Processor Configuration โ
Command line โ
The -c option takes a name/value pair: the processor name (starting lowercase) and the option name, separated by a dot (.).
To list the available processor names and options use -D. It still requires a source path, e.g. ./vendor/bin/openapi -D src. Unknown keys are reported as warnings.
> ./vendor/bin/openapi -c operationId.hash=true src
> ./vendor/bin/openapi -c pathFilter.tags[]=/pets/ -c pathFilter.tags[]=/store/ srcProgrammatically with PHP โ
Configuration can be set using the Generator::setConfig() method. Keys can either be the same as on the command line or be broken down into nested arrays.
(new Generator())
->setConfig([
'operationId.hash' => true,
'pathFilter' => [
'tags' => [
'/pets/',
'/store/',
],
],
]);Default Processors โ
DocBlockDescriptions โ
Checks if the annotation has a summary and/or description property and uses the text in the comment block (above the annotations) as summary and/or description.
Use null, for example @Annotation(description=null), if you don't want the annotation to have a description.
MergeIntoOpenApi โ
Merge all @OA\OpenApi annotations into one.
Config settings โ
- mergeIntoOpenApi.mergeComponents :
boolยท default:false
If set totrueallow multiple@OA\Componentsannotations to be merged.
MergeIntoComponents โ
Merge reusable annotation into @OA\Schemas.
ExpandClasses โ
Iterate over the chain of ancestors of a schema and:
- if the ancestor has a schema => inherit from the ancestor if it has a schema (allOf) and stop.
- else => merge ancestor properties into the schema.
ExpandInterfaces โ
Look at all (direct) interfaces for a schema and:
- merge interfaces annotations/methods into the schema if the interface does not have a schema itself
- inherit from the interface if it has a schema (allOf).
ExpandTraits โ
Look at all (direct) traits for a schema and:
- merge trait annotations/methods/properties into the schema if the trait does not have a schema itself
- inherit from the trait if it has a schema (allOf).
ExpandEnums โ
Expands PHP enums.
Determines schema, enum and type.
Config settings โ
expandEnums.enumNames :
stringยท default:null
Specifies the name of the extension variable where backed enum names will be stored. Set tonullto avoid writing backed enum names.Example:
->setEnumNames('enumNames')yields:yamlx-enumNames: - NAME1 - NAME2
AugmentSchemas โ
Use the Schema context to extract useful information and inject that into the annotation.
Merges properties.
AugmentRequestBody โ
Use the RequestBody context to extract useful information and inject that into the annotation.
AugmentProperties โ
Use the property context to extract useful information and inject that into the annotation.
AugmentDiscriminators โ
Use the property context to extract useful information and inject that into the annotation.
BuildPaths โ
Build the openapi->paths using the detected @OA\PathItem and @OA\Operation (@OA\Get, etc).
AugmentParameters โ
Augments shared and operations parameters from docblock comments.
Config settings โ
- augmentParameters.augmentOperationParameters :
boolยท default:true
If set totruetry to find operation parameter descriptions in the operation docblock.
AugmentRefs โ
AugmentItems โ
Use the Schema context to extract useful information and inject that into the annotation.
Merges properties.
MergeJsonContent โ
Split JsonContent into Schema and MediaType.
MergeXmlContent โ
Split XmlContent into Schema and MediaType.
AugmentMediaType โ
Augment media type encodings.
OperationId โ
Generate the OperationId based on the context of the OpenApi annotation.
Config settings โ
- operationId.hash :
boolยท default:true
If set totruegenerate ids (md5) instead of clear text operation ids.
CleanUnmerged โ
PathFilter โ
Allows to filter endpoints based on tags and/or path.
If no tags or paths filters are set, no filtering is performed.
All filter (regular) expressions must be enclosed within delimiter characters as they are used as-is.
Config settings โ
- pathFilter.tags :
arrayยท default:[]
A list of regular expressions to matchtagsto include. - pathFilter.paths :
arrayยท default:[]
A list of regular expressions to matchpathsto include.
CleanUnusedComponents โ
Tracks the use of all Components and removed unused schemas.
Config settings โ
- cleanUnusedComponents.enabled :
boolยท default:false
Enables/disables theCleanUnusedComponentsprocessor.
AugmentTags โ
Ensures that all tags used on operations also exist in the global tags list.
Config settings โ
- augmentTags.whitelist :
arrayยท default:[]
Whitelist tags to keep even if not used.*may be used to keep all unused. - augmentTags.withDescription :
boolยท default:true
Enables/disables generation of default tag descriptions.