aws-cdk-lib.aws_apigateway.JsonSchemaVersion

enum JsonSchemaVersion

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.JsonSchemaVersion
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#JsonSchemaVersion
Javasoftware.amazon.awscdk.services.apigateway.JsonSchemaVersion
Pythonaws_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

NameDescription
DRAFT4In 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


DRAFT7