aws-cdk-lib.aws_apigateway.JsonSchemaType
enum JsonSchemaType
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.APIGateway.JsonSchemaType |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#JsonSchemaType |
![]() | software.amazon.awscdk.services.apigateway.JsonSchemaType |
![]() | aws_cdk.aws_apigateway.JsonSchemaType |
![]() | aws-cdk-lib » aws_apigateway » JsonSchemaType |
Example
declare const api: apigateway.RestApi;
// We define the JSON Schema for the transformed valid response
const responseModel = api.addModel('ResponseModel', {
contentType: 'application/json',
modelName: 'ResponseModel',
schema: {
schema: apigateway.JsonSchemaVersion.DRAFT4,
title: 'pollResponse',
type: apigateway.JsonSchemaType.OBJECT,
properties: {
state: { type: apigateway.JsonSchemaType.STRING },
greeting: { type: apigateway.JsonSchemaType.STRING }
}
}
});
// We define the JSON Schema for the transformed error response
const errorResponseModel = api.addModel('ErrorResponseModel', {
contentType: 'application/json',
modelName: 'ErrorResponseModel',
schema: {
schema: apigateway.JsonSchemaVersion.DRAFT4,
title: 'errorResponse',
type: apigateway.JsonSchemaType.OBJECT,
properties: {
state: { type: apigateway.JsonSchemaType.STRING },
message: { type: apigateway.JsonSchemaType.STRING }
}
}
});
Members
Name | Description |
---|---|
NULL | |
BOOLEAN | |
OBJECT | |
ARRAY | |
NUMBER | |
INTEGER | |
STRING |