enum JsonSchemaVersion
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.JsonSchemaVersion |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#JsonSchemaVersion |
Java | software.amazon.awscdk.services.apigateway.JsonSchemaVersion |
Python | aws_cdk.aws_apigateway.JsonSchemaVersion |
TypeScript (source) | aws-cdk-lib » aws_apigateway » JsonSchemaVersion |
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 |
---|---|
DRAFT4 | In API Gateway models are defined using the JSON schema draft 4. |
DRAFT7 |
DRAFT4
In API Gateway models are defined using the JSON schema draft 4.
See also: https://tools.ietf.org/html/draft-zyp-json-schema-04