Class AwsRestJson1Protocol

java.lang.Object
software.amazon.smithy.openapi.fromsmithy.protocols.AwsRestJson1Protocol
All Implemented Interfaces:
OpenApiProtocol<software.amazon.smithy.aws.traits.protocols.RestJson1Trait>

public final class AwsRestJson1Protocol extends Object
Converts the aws.protocols#restJson1 protocol to OpenAPI.
  • Constructor Details

    • AwsRestJson1Protocol

      public AwsRestJson1Protocol()
  • Method Details

    • getProtocolType

      public Class<software.amazon.smithy.aws.traits.protocols.RestJson1Trait> getProtocolType()
      Description copied from interface: OpenApiProtocol
      Gets the protocol type that this converter handles.
      Returns:
      Returns the shape ID.
    • getProtocolRequestHeaders

      public Set<String> getProtocolRequestHeaders(Context<software.amazon.smithy.aws.traits.protocols.RestJson1Trait> context, software.amazon.smithy.model.shapes.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 interface OpenApiProtocol<software.amazon.smithy.aws.traits.protocols.RestJson1Trait>
      Parameters:
      context - OpenAPI context
      operationShape - Smithy operation
      Returns:
      Returns a set of header names.
    • getProtocolResponseHeaders

      public Set<String> getProtocolResponseHeaders(Context<software.amazon.smithy.aws.traits.protocols.RestJson1Trait> context, software.amazon.smithy.model.shapes.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 interface OpenApiProtocol<software.amazon.smithy.aws.traits.protocols.RestJson1Trait>
      Parameters:
      context - OpenAPI context
      operationShape - Smithy operation
      Returns:
      Returns a set of header names.
    • updateDefaultSettings

      public void updateDefaultSettings(software.amazon.smithy.model.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 Optional<OpenApiProtocol.Operation> createOperation(Context<software.amazon.smithy.aws.traits.protocols.RestJson1Trait> context, software.amazon.smithy.model.shapes.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) and OpenApiProtocol.getOperationMethod(software.amazon.smithy.openapi.fromsmithy.Context<T>, software.amazon.smithy.model.shapes.OperationShape) when creating the Operation object.

      Specified by:
      createOperation in interface OpenApiProtocol<T extends software.amazon.smithy.model.traits.Trait>
      Parameters:
      context - The build context.
      operation - The operation shape to create.
      Returns:
      Returns the optionally created operation entry.
    • getEventStreamMediaType

      protected String getEventStreamMediaType(Context<software.amazon.smithy.aws.traits.protocols.RestJson1Trait> context, software.amazon.smithy.model.knowledge.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.