Interface IModelOptions
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IModelOptions
Syntax (vb)
Public Interface IModelOptions
Remarks
ExampleMetadata: infused
Examples
RestApi api;
// We define the JSON Schema for the transformed valid response
var responseModel = api.AddModel("ResponseModel", new ModelOptions {
ContentType = "application/json",
ModelName = "ResponseModel",
Schema = new JsonSchema {
Schema = JsonSchemaVersion.DRAFT4,
Title = "pollResponse",
Type = JsonSchemaType.OBJECT,
Properties = new Dictionary<string, JsonSchema> {
{ "state", new JsonSchema { Type = JsonSchemaType.STRING } },
{ "greeting", new JsonSchema { Type = JsonSchemaType.STRING } }
}
}
});
// We define the JSON Schema for the transformed error response
var errorResponseModel = api.AddModel("ErrorResponseModel", new ModelOptions {
ContentType = "application/json",
ModelName = "ErrorResponseModel",
Schema = new JsonSchema {
Schema = JsonSchemaVersion.DRAFT4,
Title = "errorResponse",
Type = JsonSchemaType.OBJECT,
Properties = new Dictionary<string, JsonSchema> {
{ "state", new JsonSchema { Type = JsonSchemaType.STRING } },
{ "message", new JsonSchema { Type = JsonSchemaType.STRING } }
}
}
});
Synopsis
Properties
Content |
The content type for the model. |
Description | A description that identifies this model. |
Model |
|
Schema | The schema to use to transform data to one or more output formats. |
Properties
ContentType
The content type for the model.
virtual string ContentType { get; }
Property Value
System.
Remarks
You can also force a content type in the request or response model mapping.
Default: 'application/json'
Description
A description that identifies this model.
virtual string Description { get; }
Property Value
System.
Remarks
Default: None
ModelName
virtual string ModelName { get; }
Property Value
System.
Schema
The schema to use to transform data to one or more output formats.
IJsonSchema Schema { get; }
Property Value
Remarks
Specify null ({}) if you don't want to specify a schema.