Class JsonSchema
Represents a JSON schema definition of the structure of a REST API model.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.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
Constructors
JsonSchema()
public JsonSchema()
Properties
AdditionalItems
AdditionalProperties
public object AdditionalProperties { get; set; }
Property Value
System.Object
AllOf
AnyOf
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
OneOf
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
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>