@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:36.197Z") @Stability(value=Stable) public interface ModelOptions extends software.amazon.jsii.JsiiSerializable
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());
| Modifier and Type | Interface and Description |
|---|---|
static class |
ModelOptions.Builder
A builder for
ModelOptions |
static class |
ModelOptions.Jsii$Proxy
An implementation for
ModelOptions |
| Modifier and Type | Method and Description |
|---|---|
static ModelOptions.Builder |
builder() |
default String |
getContentType()
The content type for the model.
|
default String |
getDescription()
A description that identifies this model.
|
default String |
getModelName()
A name for the model.
|
JsonSchema |
getSchema()
The schema to use to transform data to one or more output formats.
|
@Stability(value=Stable) @NotNull JsonSchema getSchema()
Specify null ({}) if you don't want to specify a schema.
@Stability(value=Stable) @Nullable default String getContentType()
You can also force a content type in the request or response model mapping.
Default: 'application/json'
@Stability(value=Stable) @Nullable default String getDescription()
Default: None
@Stability(value=Stable) @Nullable default String getModelName()
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:
@Stability(value=Stable) static ModelOptions.Builder builder()
ModelOptions.Builder of ModelOptionsCopyright © 2022. All rights reserved.