Interface ModelOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
ModelProps
All Known Implementing Classes:
ModelOptions.Jsii$Proxy, ModelProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.020Z") @Stability(Stable) public interface ModelOptions extends software.amazon.jsii.JsiiSerializable
Example:

 RestApi api;
 // We define the JSON Schema for the transformed valid response
 Model responseModel = api.addModel("ResponseModel", ModelOptions.builder()
         .contentType("application/json")
         .modelName("ResponseModel")
         .schema(JsonSchema.builder()
                 .schema(JsonSchemaVersion.DRAFT4)
                 .title("pollResponse")
                 .type(JsonSchemaType.OBJECT)
                 .properties(Map.of(
                         "state", JsonSchema.builder().type(JsonSchemaType.STRING).build(),
                         "greeting", JsonSchema.builder().type(JsonSchemaType.STRING).build()))
                 .build())
         .build());
 // We define the JSON Schema for the transformed error response
 Model errorResponseModel = api.addModel("ErrorResponseModel", ModelOptions.builder()
         .contentType("application/json")
         .modelName("ErrorResponseModel")
         .schema(JsonSchema.builder()
                 .schema(JsonSchemaVersion.DRAFT4)
                 .title("errorResponse")
                 .type(JsonSchemaType.OBJECT)
                 .properties(Map.of(
                         "state", JsonSchema.builder().type(JsonSchemaType.STRING).build(),
                         "message", JsonSchema.builder().type(JsonSchemaType.STRING).build()))
                 .build())
         .build());
 
  • Method Details

    • getSchema

      @Stability(Stable) @NotNull JsonSchema getSchema()
      The schema to use to transform data to one or more output formats.

      Specify null ({}) if you don't want to specify a schema.

    • getContentType

      @Stability(Stable) @Nullable default String getContentType()
      The content type for the model.

      You can also force a content type in the request or response model mapping.

      Default: 'application/json'

    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
      A description that identifies this model.

      Default: None

    • getModelName

      @Stability(Stable) @Nullable default String getModelName()
      A name for the model.

      Important If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

      Default: If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.

    • builder

      @Stability(Stable) static ModelOptions.Builder builder()
      Returns:
      a ModelOptions.Builder of ModelOptions