Bedrock Data Automation Blueprint-validator meta schema

Better data automation uses so-called blueprints to identify which fields it should extract. These blueprints are following a specific JSON pattern that AWS validates. If for any reason you are building a wrapper and you need to validate this JSON before you actually send it to AWS, then I created a custom metaschema that does that for you.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://example.com/schemas/bda-blueprint-friendly.schema.json",
  "title": "BDA Blueprint Meta-Schema (Human Friendly)",
  "type": "object",
  "required": [
    "type",
    "properties",
    "class"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "class": {
      "type": "string"
    },
    "type": {
      "const": "object"
    },
    "definitions": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/fieldSchema"
      }
    },
    "properties": {
      "type": "object",
      "minProperties": 1,
      "maxProperties": 100,
      "additionalProperties": {
        "$ref": "#/definitions/fieldSchema"
      }
    }
  },
  "additionalProperties": false,
  "definitions": {
    "fieldSchema": {
      "if": {
        "required": [
          "$ref"
        ]
      },
      "then": {
        "$ref": "#/definitions/referenceField"
      },
      "else": {
        "$ref": "#/definitions/directValueField"
      }
    },
    "referenceField": {
      "title": "Reference Field",
      "type": "object",
      "required": [
        "$ref",
        "instruction"
      ],
      "properties": {
        "$ref": {
          "type": "string"
        },
        "instruction": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "directValueField": {
      "title": "Direct Value Field",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "object",
            "array",
            "string",
            "number",
            "integer",
            "boolean",
            "null"
          ]
        },
        "instruction": {
          "type": "string",
          "minLength": 1
        },
        "inferenceType": {
          "type": "string",
          "enum": [
            "explicit",
            "implicit"
          ]
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/fieldSchema"
          }
        },
        "items": {
          "$ref": "#/definitions/fieldSchema"
        },
        "enum": {
          "type": "array"
        },
        "pattern": {
          "type": "string"
        },
        "format": {
          "type": "string"
        },
        "minimum": {
          "type": "number"
        },
        "maximum": {
          "type": "number"
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "const": "object"
              }
            }
          },
          "then": {
            "required": [
              "properties"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "array"
              }
            }
          },
          "then": {
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "enum": [
                  "string",
                  "number",
                  "integer",
                  "boolean"
                ]
              }
            }
          },
          "then": {
            "required": [
              "instruction",
              "inferenceType"
            ]
          }
        }
      ]
    }
  }
}
Continue ReadingBedrock Data Automation Blueprint-validator meta schema