Class AwsRestJson1Protocol
- java.lang.Object
-
- software.amazon.smithy.openapi.fromsmithy.protocols.AwsRestJson1Protocol
-
- All Implemented Interfaces:
OpenApiProtocol<RestJson1Trait>
public final class AwsRestJson1Protocol extends java.lang.Object
Converts theaws.protocols#restJson1
protocol to OpenAPI.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface software.amazon.smithy.openapi.fromsmithy.OpenApiProtocol
OpenApiProtocol.Operation
-
-
Constructor Summary
Constructors Constructor Description AwsRestJson1Protocol()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<OpenApiProtocol.Operation>
createOperation(Context<T> context, OperationShape operation)
Creates an operation entry, including the method, URI, and operation object builder.protected java.lang.String
getEventStreamMediaType(Context<T> context, EventStreamInfo info)
Gets the media type of an event stream for the protocol.java.util.Set<java.lang.String>
getProtocolRequestHeaders(Context<RestJson1Trait> context, OperationShape operationShape)
Gets the unmodeled protocol-specific HTTP headers of a request that are considered significant for the provided operation.java.util.Set<java.lang.String>
getProtocolResponseHeaders(Context<RestJson1Trait> context, OperationShape operationShape)
Gets the unmodeled protocol-specific HTTP headers of a response that are considered significant for the provided operation.java.lang.Class<RestJson1Trait>
getProtocolType()
Gets the protocol type that this converter handles.void
updateDefaultSettings(Model model, OpenApiConfig config)
Sets protocol-specific default values on the OpenAPI configuration object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.openapi.fromsmithy.OpenApiProtocol
getOperationMethod, getOperationResponseStatusCode, getOperationUri
-
-
-
-
Method Detail
-
getProtocolType
public java.lang.Class<RestJson1Trait> getProtocolType()
Description copied from interface:OpenApiProtocol
Gets the protocol type that this converter handles.- Returns:
- Returns the shape ID.
-
getProtocolRequestHeaders
public java.util.Set<java.lang.String> getProtocolRequestHeaders(Context<RestJson1Trait> context, OperationShape operationShape)
Description copied from interface:OpenApiProtocol
Gets the unmodeled protocol-specific HTTP headers of a request that are considered significant for the provided operation.These protocol specific headers are not automatically added to requests, but are used when integrating with things like CORS.
- Specified by:
getProtocolRequestHeaders
in interfaceOpenApiProtocol<RestJson1Trait>
- Parameters:
context
- OpenAPI contextoperationShape
- Smithy operation- Returns:
- Returns a set of header names.
-
getProtocolResponseHeaders
public java.util.Set<java.lang.String> getProtocolResponseHeaders(Context<RestJson1Trait> context, OperationShape operationShape)
Description copied from interface:OpenApiProtocol
Gets the unmodeled protocol-specific HTTP headers of a response that are considered significant for the provided operation.These protocol specific headers are not automatically added to responses, but are used when integrating with things like CORS.
- Specified by:
getProtocolResponseHeaders
in interfaceOpenApiProtocol<RestJson1Trait>
- Parameters:
context
- OpenAPI contextoperationShape
- Smithy operation- Returns:
- Returns a set of header names.
-
updateDefaultSettings
public void updateDefaultSettings(Model model, OpenApiConfig config)
Description copied from interface:OpenApiProtocol
Sets protocol-specific default values on the OpenAPI configuration object.- Parameters:
model
- Model being converted.config
- Configuration object to modify.
-
createOperation
public java.util.Optional<OpenApiProtocol.Operation> createOperation(Context<T> context, OperationShape operation)
Description copied from interface:OpenApiProtocol
Creates an operation entry, including the method, URI, and operation object builder. The returned operation object builder should contain protocol-specific fields of an OpenAPI Operation object, such as: [parameters, requestBody, responses] and [examples for any of the above, contained by respective objects that the example values are for]. The returned operation object builder should not contain protocol-agnostic fields of an OpenAPI Operation object, such as: tags, summary, description, externalDocs, deprecated, security.The operation is returned as an empty Optional if the operation is not supported by the protocol. This method should make calls to
OpenApiProtocol.getOperationUri(software.amazon.smithy.openapi.fromsmithy.Context<T>, software.amazon.smithy.model.shapes.OperationShape)
andOpenApiProtocol.getOperationMethod(software.amazon.smithy.openapi.fromsmithy.Context<T>, software.amazon.smithy.model.shapes.OperationShape)
when creating the Operation object.- Specified by:
createOperation
in interfaceOpenApiProtocol<T extends Trait>
- Parameters:
context
- The build context.operation
- The operation shape to create.- Returns:
- Returns the optionally created operation entry.
-
getEventStreamMediaType
protected java.lang.String getEventStreamMediaType(Context<T> context, EventStreamInfo info)
Gets the media type of an event stream for the protocol.By default, this method returns the binary AWS event stream media type,
application/vnd.amazon.eventstream
.- Parameters:
context
- Conversion context.info
- Event stream info to provide the media type for.- Returns:
- Returns the media type of the event stream.
-
-