Show / Hide Table of Contents

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
Model 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
Model 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

ContentType

The content type for the model.

Description

A description that identifies this model.

ModelName
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.String

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.String

Remarks

Default: None

ModelName

virtual string ModelName { get; }
Property Value

System.String

Schema

The schema to use to transform data to one or more output formats.

IJsonSchema Schema { get; }
Property Value

IJsonSchema

Remarks

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

Back to top Generated by DocFX