Table of Contents

Interface IJsonSchema

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

Represents a JSON schema definition of the structure of a REST API model.

public interface IJsonSchema

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

Copied from npm module jsonschema.

See: https://github.com/tdegrunt/jsonschema

ExampleMetadata: infused

Properties

AdditionalItems

IJsonSchema[]? AdditionalItems { get; }

Property Value

IJsonSchema[]

AdditionalProperties

object? AdditionalProperties { get; }

Property Value

object

AllOf

IJsonSchema[]? AllOf { get; }

Property Value

IJsonSchema[]

AnyOf

IJsonSchema[]? AnyOf { get; }

Property Value

IJsonSchema[]

Contains

object? Contains { get; }

Property Value

object

Default

The default value if you use an enum.

object? Default { get; }

Property Value

object

Remarks

Default: - not set

Definitions

IDictionary<string, IJsonSchema>? Definitions { get; }

Property Value

IDictionary<string, IJsonSchema>

Dependencies

IDictionary<string, object>? Dependencies { get; }

Property Value

IDictionary<string, object>

Description

string? Description { get; }

Property Value

string

Enum

object[]? Enum { get; }

Property Value

object[]

ExclusiveMaximum

bool? ExclusiveMaximum { get; }

Property Value

bool?

ExclusiveMinimum

bool? ExclusiveMinimum { get; }

Property Value

bool?

Format

string? Format { get; }

Property Value

string

Id

string? Id { get; }

Property Value

string

Items

object? Items { get; }

Property Value

object

MaxItems

double? MaxItems { get; }

Property Value

double?

MaxLength

double? MaxLength { get; }

Property Value

double?

MaxProperties

double? MaxProperties { get; }

Property Value

double?

Maximum

double? Maximum { get; }

Property Value

double?

MinItems

double? MinItems { get; }

Property Value

double?

MinLength

double? MinLength { get; }

Property Value

double?

MinProperties

double? MinProperties { get; }

Property Value

double?

Minimum

double? Minimum { get; }

Property Value

double?

MultipleOf

double? MultipleOf { get; }

Property Value

double?

Not

IJsonSchema? Not { get; }

Property Value

IJsonSchema

OneOf

IJsonSchema[]? OneOf { get; }

Property Value

IJsonSchema[]

Pattern

string? Pattern { get; }

Property Value

string

PatternProperties

IDictionary<string, IJsonSchema>? PatternProperties { get; }

Property Value

IDictionary<string, IJsonSchema>

Properties

IDictionary<string, IJsonSchema>? Properties { get; }

Property Value

IDictionary<string, IJsonSchema>

PropertyNames

IJsonSchema? PropertyNames { get; }

Property Value

IJsonSchema

Ref

string? Ref { get; }

Property Value

string

Required

string[]? Required { get; }

Property Value

string[]

Schema

JsonSchemaVersion? Schema { get; }

Property Value

JsonSchemaVersion?

Title

string? Title { get; }

Property Value

string

Type

object? Type { get; }

Property Value

object

UniqueItems

bool? UniqueItems { get; }

Property Value

bool?