Skip to content
v2.278.0

JsonSchemaValidator Class ​

Defines a JSON Schema validator.

Example ​

ts
declare const application: appconfig.Application;
declare const fn: lambda.Function;

new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', {
  application,
  content: appconfig.ConfigurationContent.fromInlineText('This is my configuration content.'),
  validators: [
    appconfig.JsonSchemaValidator.fromFile('schema.json'),
    appconfig.LambdaValidator.fromFunction(fn),
  ],
});
python
# application: appconfig.Application
# fn: lambda.Function


appconfig.HostedConfiguration(self, "MyHostedConfiguration",
    application=application,
    content=appconfig.ConfigurationContent.from_inline_text("This is my configuration content."),
    validators=[
        appconfig.JsonSchemaValidator.from_file("schema.json"),
        appconfig.LambdaValidator.from_function(fn)
    ]
)
java
Application application;
Function fn;


HostedConfiguration.Builder.create(this, "MyHostedConfiguration")
        .application(application)
        .content(ConfigurationContent.fromInlineText("This is my configuration content."))
        .validators(List.of(JsonSchemaValidator.fromFile("schema.json"), LambdaValidator.fromFunction(fn)))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Application application;
Function fn;


new HostedConfiguration(this, "MyHostedConfiguration", new HostedConfigurationProps {
    Application = application,
    Content = ConfigurationContent.FromInlineText("This is my configuration content."),
    Validators = new [] { JsonSchemaValidator.FromFile("schema.json"), LambdaValidator.FromFunction(fn) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var application Application
var fn Function


appconfig.NewHostedConfiguration(this, jsii.String("MyHostedConfiguration"), &HostedConfigurationProps{
	Application: Application,
	Content: appconfig.ConfigurationContent_FromInlineText(jsii.String("This is my configuration content.")),
	Validators: []IValidator{
		appconfig.JsonSchemaValidator_FromFile(jsii.String("schema.json")),
		appconfig.LambdaValidator_FromFunction(fn),
	},
})

Initializer ​

ts
new JsonSchemaValidator()
python
JsonSchemaValidator()
java
new JsonSchemaValidator()
csharp
new JsonSchemaValidator()
go
NewJsonSchemaValidator()

Properties ​

contentstringcontentstrcontentStringContentstringContent*string #
The content of the validator.

Methods ​

fromFile(inputPath: string): JsonSchemaValidator // chainable@staticmethod def from_file(input_path: str) -> JsonSchemaValidatorpublic static JsonSchemaValidator fromFile(String inputPath)public static JsonSchemaValidator FromFile(string inputPath)func FromFile(InputPath *string) JsonSchemaValidator static #
Defines a JSON Schema validator from a file.
1 parameter

Parameters

  • inputPathinput_pathinputPathinputPathInputPath — The path to the file that defines the validator.
fromInline(code: string): JsonSchemaValidator // chainable@staticmethod def from_inline(code: str) -> JsonSchemaValidatorpublic static JsonSchemaValidator fromInline(String code)public static JsonSchemaValidator FromInline(string code)func FromInline(Code *string) JsonSchemaValidator static #
Defines a JSON Schema validator from inline code.
1 parameter

Parameters

  • codecodecodecodeCode — The inline code that defines the validator.