Table of Contents

Enum JsonSchemaType

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll
public enum JsonSchemaType

Fields

ARRAY = 3
BOOLEAN = 1
INTEGER = 5
NULL = 0
NUMBER = 4
OBJECT = 2
STRING = 6

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 } }
                    }
                }
            });

Remarks

ExampleMetadata: infused