Interface IJsonSchema
Represents a JSON schema definition of the structure of a REST API model.
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IJsonSchema
Syntax (vb)
Public Interface 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
Properties
Properties
AdditionalItems
AdditionalProperties
virtual object AdditionalProperties { get; }
Property Value
System.Object
AllOf
AnyOf
Contains
virtual object Contains { get; }
Property Value
System.Object
Default
The default value if you use an enum.
virtual object Default { get; }
Property Value
System.Object
Remarks
Default: - not set
Definitions
virtual IDictionary<string, IJsonSchema> Definitions { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, IJsonSchema>
Dependencies
virtual IDictionary<string, object> Dependencies { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Description
virtual string Description { get; }
Property Value
System.String
Enum
virtual object[] Enum { get; }
Property Value
System.Object[]
ExclusiveMaximum
virtual Nullable<bool> ExclusiveMaximum { get; }
Property Value
System.Nullable<System.Boolean>
ExclusiveMinimum
virtual Nullable<bool> ExclusiveMinimum { get; }
Property Value
System.Nullable<System.Boolean>
Format
virtual string Format { get; }
Property Value
System.String
Id
virtual string Id { get; }
Property Value
System.String
Items
virtual object Items { get; }
Property Value
System.Object
Maximum
virtual Nullable<double> Maximum { get; }
Property Value
System.Nullable<System.Double>
MaxItems
virtual Nullable<double> MaxItems { get; }
Property Value
System.Nullable<System.Double>
MaxLength
virtual Nullable<double> MaxLength { get; }
Property Value
System.Nullable<System.Double>
MaxProperties
virtual Nullable<double> MaxProperties { get; }
Property Value
System.Nullable<System.Double>
Minimum
virtual Nullable<double> Minimum { get; }
Property Value
System.Nullable<System.Double>
MinItems
virtual Nullable<double> MinItems { get; }
Property Value
System.Nullable<System.Double>
MinLength
virtual Nullable<double> MinLength { get; }
Property Value
System.Nullable<System.Double>
MinProperties
virtual Nullable<double> MinProperties { get; }
Property Value
System.Nullable<System.Double>
MultipleOf
virtual Nullable<double> MultipleOf { get; }
Property Value
System.Nullable<System.Double>
Not
OneOf
Pattern
virtual string Pattern { get; }
Property Value
System.String
PatternProperties
virtual IDictionary<string, IJsonSchema> PatternProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, IJsonSchema>
Properties
virtual IDictionary<string, IJsonSchema> Properties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, IJsonSchema>
PropertyNames
Ref
virtual string Ref { get; }
Property Value
System.String
Required
virtual string[] Required { get; }
Property Value
System.String[]
Schema
virtual Nullable<JsonSchemaVersion> Schema { get; }
Property Value
System.Nullable<JsonSchemaVersion>
Title
virtual string Title { get; }
Property Value
System.String
Type
virtual object Type { get; }
Property Value
System.Object
UniqueItems
virtual Nullable<bool> UniqueItems { get; }
Property Value
System.Nullable<System.Boolean>