Show / Hide Table of Contents

Class ModelOptions

Inheritance
System.Object
ModelOptions
Implements
IModelOptions
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ModelOptions : Object, IModelOptions
Syntax (vb)
Public Class ModelOptions
    Inherits Object
    Implements 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

Constructors

ModelOptions()

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.

Constructors

ModelOptions()

public ModelOptions()

Properties

ContentType

The content type for the model.

public string ContentType { get; set; }
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.

public string Description { get; set; }
Property Value

System.String

Remarks

Default: None

ModelName

public string ModelName { get; set; }
Property Value

System.String

Schema

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

public IJsonSchema Schema { get; set; }
Property Value

IJsonSchema

Remarks

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

Implements

IModelOptions
Back to top Generated by DocFX