Show / Hide Table of Contents

Class JsonSchema

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

Inheritance
System.Object
JsonSchema
Implements
IJsonSchema
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class JsonSchema : Object, IJsonSchema
Syntax (vb)
Public Class JsonSchema
    Inherits Object
    Implements IJsonSchema
Remarks

Copied from npm module jsonschema.

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

ExampleMetadata: infused

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

Synopsis

Constructors

JsonSchema()

Properties

AdditionalItems
AdditionalProperties
AllOf
AnyOf
Contains
Default

The default value if you use an enum.

Definitions
Dependencies
Description
Enum
ExclusiveMaximum
ExclusiveMinimum
Format
Id
Items
Maximum
MaxItems
MaxLength
MaxProperties
Minimum
MinItems
MinLength
MinProperties
MultipleOf
Not
OneOf
Pattern
PatternProperties
Properties
PropertyNames
Ref
Required
Schema
Title
Type
UniqueItems

Constructors

JsonSchema()

public JsonSchema()

Properties

AdditionalItems

public IJsonSchema[] AdditionalItems { get; set; }
Property Value

IJsonSchema[]

AdditionalProperties

public object AdditionalProperties { get; set; }
Property Value

System.Object

AllOf

public IJsonSchema[] AllOf { get; set; }
Property Value

IJsonSchema[]

AnyOf

public IJsonSchema[] AnyOf { get; set; }
Property Value

IJsonSchema[]

Contains

public object Contains { get; set; }
Property Value

System.Object

Default

The default value if you use an enum.

public object Default { get; set; }
Property Value

System.Object

Remarks

Default: - not set

Definitions

public IDictionary<string, IJsonSchema> Definitions { get; set; }
Property Value

System.Collections.Generic.IDictionary<System.String, IJsonSchema>

Dependencies

public IDictionary<string, object> Dependencies { get; set; }
Property Value

System.Collections.Generic.IDictionary<System.String, System.Object>

Description

public string Description { get; set; }
Property Value

System.String

Enum

public object[] Enum { get; set; }
Property Value

System.Object[]

ExclusiveMaximum

public Nullable<bool> ExclusiveMaximum { get; set; }
Property Value

System.Nullable<System.Boolean>

ExclusiveMinimum

public Nullable<bool> ExclusiveMinimum { get; set; }
Property Value

System.Nullable<System.Boolean>

Format

public string Format { get; set; }
Property Value

System.String

Id

public string Id { get; set; }
Property Value

System.String

Items

public object Items { get; set; }
Property Value

System.Object

Maximum

public Nullable<double> Maximum { get; set; }
Property Value

System.Nullable<System.Double>

MaxItems

public Nullable<double> MaxItems { get; set; }
Property Value

System.Nullable<System.Double>

MaxLength

public Nullable<double> MaxLength { get; set; }
Property Value

System.Nullable<System.Double>

MaxProperties

public Nullable<double> MaxProperties { get; set; }
Property Value

System.Nullable<System.Double>

Minimum

public Nullable<double> Minimum { get; set; }
Property Value

System.Nullable<System.Double>

MinItems

public Nullable<double> MinItems { get; set; }
Property Value

System.Nullable<System.Double>

MinLength

public Nullable<double> MinLength { get; set; }
Property Value

System.Nullable<System.Double>

MinProperties

public Nullable<double> MinProperties { get; set; }
Property Value

System.Nullable<System.Double>

MultipleOf

public Nullable<double> MultipleOf { get; set; }
Property Value

System.Nullable<System.Double>

Not

public IJsonSchema Not { get; set; }
Property Value

IJsonSchema

OneOf

public IJsonSchema[] OneOf { get; set; }
Property Value

IJsonSchema[]

Pattern

public string Pattern { get; set; }
Property Value

System.String

PatternProperties

public IDictionary<string, IJsonSchema> PatternProperties { get; set; }
Property Value

System.Collections.Generic.IDictionary<System.String, IJsonSchema>

Properties

public IDictionary<string, IJsonSchema> Properties { get; set; }
Property Value

System.Collections.Generic.IDictionary<System.String, IJsonSchema>

PropertyNames

public IJsonSchema PropertyNames { get; set; }
Property Value

IJsonSchema

Ref

public string Ref { get; set; }
Property Value

System.String

Required

public string[] Required { get; set; }
Property Value

System.String[]

Schema

public Nullable<JsonSchemaVersion> Schema { get; set; }
Property Value

System.Nullable<JsonSchemaVersion>

Title

public string Title { get; set; }
Property Value

System.String

Type

public object Type { get; set; }
Property Value

System.Object

UniqueItems

public Nullable<bool> UniqueItems { get; set; }
Property Value

System.Nullable<System.Boolean>

Implements

IJsonSchema
Back to top Generated by DocFX