Skip to content

Instantly share code, notes, and snippets.

@vladbarosan
Created February 17, 2018 02:07
Show Gist options
  • Save vladbarosan/489f0f8bc6c73e367d9907ab94bbf936 to your computer and use it in GitHub Desktop.
Save vladbarosan/489f0f8bc6c73e367d9907ab94bbf936 to your computer and use it in GitHub Desktop.
ajv vs zschema validation
[{
"keyword": "enum",
"dataPath": ".sku.name",
"schemaPath": "#/properties/sku/properties/name/enum",
"params": {
"allowedValues": ["Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".sku.tier",
"schemaPath": "#/properties/sku/properties/tier/enum",
"params": {
"allowedValues": ["Standard", "Premium"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".kind",
"schemaPath": "#/properties/kind/enum",
"params": {
"allowedValues": ["Storage", "StorageV2", "BlobStorage"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".properties.provisioningState",
"schemaPath": "#/properties/properties/properties/provisioningState/enum",
"params": {
"allowedValues": ["Creating", "ResolvingDNS", "Succeeded"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".properties.statusOfPrimary",
"schemaPath": "#/properties/properties/properties/statusOfPrimary/enum",
"params": {
"allowedValues": ["available", "unavailable"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".properties.statusOfSecondary",
"schemaPath": "#/properties/properties/properties/statusOfSecondary/enum",
"params": {
"allowedValues": ["available", "unavailable"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "format",
"dataPath": ".properties.creationTime",
"schemaPath": "#/properties/properties/properties/creationTime/format",
"params": {
"format": "date-time"
},
"message": "should match format \"date-time\""
}, {
"keyword": "format",
"dataPath": ".properties.encryption.services.blob.lastEnabledTime",
"schemaPath": "#/properties/properties/properties/encryption/properties/services/properties/blob/properties/lastEnabledTime/format",
"params": {
"format": "date-time"
},
"message": "should match format \"date-time\""
}, {
"keyword": "format",
"dataPath": ".properties.encryption.services.file.lastEnabledTime",
"schemaPath": "#/properties/properties/properties/encryption/properties/services/properties/file/properties/lastEnabledTime/format",
"params": {
"format": "date-time"
},
"message": "should match format \"date-time\""
}, {
"keyword": "enum",
"dataPath": ".properties.encryption.keySource",
"schemaPath": "#/properties/properties/properties/encryption/properties/keySource/enum",
"params": {
"allowedValues": ["Microsoft.Storage", "Microsoft.Keyvault"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".properties.networkAcls.bypass",
"schemaPath": "#/properties/properties/properties/networkAcls/properties/bypass/enum",
"params": {
"allowedValues": ["None", "Logging", "Metrics", "AzureServices"]
},
"message": "should be equal to one of the allowed values"
}, {
"keyword": "enum",
"dataPath": ".properties.networkAcls.defaultAction",
"schemaPath": "#/properties/properties/properties/networkAcls/properties/defaultAction/enum",
"params": {
"allowedValues": ["Allow", "Deny"]
},
"message": "should be equal to one of the allowed values"
}]
[{
"code": "ONE_OF_MISSING",
"params": [],
"message": "Data does not match any schemas from 'oneOf'",
"path": ["properties"],
"inner": [{
"code": "OBJECT_ADDITIONAL_PROPERTIES",
"params": [
["trustedDirectories"]
],
"message": "Additional properties not allowed: trustedDirectories",
"path": ["properties"],
"description": "Properties of the storage account."
}, {
"code": "INVALID_TYPE",
"params": ["null", "object"],
"message": "Expected type null but found type object",
"path": ["properties"]
}]
}, {
"code": "ONE_OF_MISSING",
"params": [],
"message": "Data does not match any schemas from 'oneOf'",
"path": ["kind"],
"inner": [{
"code": "ENUM_MISMATCH",
"params": ["aaaaaaa"],
"message": "No enum match for: aaaaaaa",
"path": ["kind"],
"description": "Gets the Kind."
}, {
"code": "INVALID_TYPE",
"params": ["null", "string"],
"message": "Expected type null but found type string",
"path": ["kind"]
}]
}, {
"code": "ONE_OF_MISSING",
"params": [],
"message": "Data does not match any schemas from 'oneOf'",
"path": ["sku"],
"inner": [{
"code": "ONE_OF_MISSING",
"params": [],
"message": "Data does not match any schemas from 'oneOf'",
"path": ["sku", "tier"],
"inner": [{
"code": "ENUM_MISMATCH",
"params": ["aaaaaaaa"],
"message": "No enum match for: aaaaaaaa",
"path": ["tier"],
"description": "Gets the sku tier. This is based on the SKU name."
}, {
"code": "INVALID_TYPE",
"params": ["null", "string"],
"message": "Expected type null but found type string",
"path": ["tier"]
}]
}, {
"code": "INVALID_TYPE",
"params": ["null", "object"],
"message": "Expected type null but found type object",
"path": ["sku"]
}]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment