Class OpenApiConverter
-
Method Summary
Modifier and TypeMethodDescriptionaddOpenApiMapper(OpenApiMapper mapper) Adds anOpenApiMapperto the converter.classLoader(ClassLoader classLoader) Sets aClassLoaderto use to discoverJsonSchemaMapper,OpenApiMapper, andOpenApiProtocolservice providers through SPI.config(OpenApiConfig config) Set the OpenAPI configuration settings.Converts the Smithy model to OpenAPI.convertToNode(Model model) Converts the given service shape to a JSON/Node representation of an OpenAPI model using the given Smithy model.static OpenApiConvertercreate()Get the OpenAPI configuration settings.
-
Method Details
-
create
-
getConfig
Get the OpenAPI configuration settings.- Returns:
- Returns the config object.
-
config
Set the OpenAPI configuration settings.This also updates the configuration object of any previously set
JsonSchemaConfig.- Parameters:
config- Config object to set.- Returns:
- Returns the converter.
-
addOpenApiMapper
Adds anOpenApiMapperto the converter.This method is used to add custom OpenApiMappers to a converter that are not automatically added by
Smithy2OpenApiExtensionobjects detected through Java SPI.- Parameters:
mapper- Mapper to add.- Returns:
- Returns the converter.
-
classLoader
Sets aClassLoaderto use to discoverJsonSchemaMapper,OpenApiMapper, andOpenApiProtocolservice providers through SPI.The
OpenApiConverterwill use its own ClassLoader by default.- Parameters:
classLoader- ClassLoader to use.- Returns:
- Returns the OpenApiConverter.
-
convert
Converts the Smithy model to OpenAPI.- Parameters:
model- Smithy model to convert.- Returns:
- Returns the converted model.
-
convertToNode
Converts the given service shape to a JSON/Node representation of an OpenAPI model using the given Smithy model.The result of this method may differ from the result of calling
Component.toNode()because this method will pass the Node representation of the OpenAPI through theOpenApiMapper.updateNode(software.amazon.smithy.openapi.fromsmithy.Context<? extends software.amazon.smithy.model.traits.Trait>, software.amazon.smithy.openapi.model.OpenApi, software.amazon.smithy.model.node.ObjectNode)method of each registeredOpenApiMapper. This may cause the returned value to no longer be a valid OpenAPI model but still representative of the desired artifact (for example, an OpenAPI model used with Amazon CloudFormation might used intrinsic JSON functions or variable expressions that are replaced when synthesized).- Parameters:
model- Smithy model to convert.- Returns:
- Returns the converted model.
-