{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-supply-chain/json-schema/amazon-supply-chain-create-data-lake-dataset-request-schema.json",
  "title": "CreateDataLakeDatasetRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-supply-chain-datalake-api-openapi.yml#/components/schemas/CreateDataLakeDatasetRequest",
  "type": "object",
  "properties": {
    "instanceId": {
      "type": "string",
      "description": "The Amazon Web Services Supply Chain instance identifier."
    },
    "namespace": {
      "type": "string",
      "description": "The namespace of the dataset, besides the custom defined namespace, every instance comes with below pre-defined namespaces: asc - For information on the Amazon Web Services Supply Chain supported datasets see https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html. default - For datasets with custom user-defined schemas."
    },
    "name": {
      "type": "string",
      "description": "The name of the dataset. For asc name space, the name must be one of the supported data entities under https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html."
    },
    "schema": {
      "$ref": "#/$defs/DataLakeDatasetSchema"
    },
    "description": {
      "type": "string",
      "description": "The description of the dataset."
    },
    "partitionSpec": {
      "$ref": "#/$defs/DataLakeDatasetPartitionSpec"
    },
    "tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The tags of the dataset."
    }
  },
  "required": [
    "instanceId",
    "namespace",
    "name"
  ],
  "$defs": {
    "DataLakeDatasetPartitionField": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the partition field."
        },
        "transform": {
          "$ref": "#/$defs/DataLakeDatasetPartitionFieldTransform"
        }
      },
      "required": [
        "name",
        "transform"
      ]
    },
    "DataLakeDatasetPartitionFieldTransform": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "YEAR",
            "MONTH",
            "DAY",
            "HOUR",
            "IDENTITY"
          ],
          "description": "The type of partitioning transformation for this field. The available options are: IDENTITY - Partitions data on a given field by its exact values. YEAR - Partitions data on a timestamp field using year granularity. MONTH - Partitions data on a timestamp field using month granularity. DAY - Partitions data on a timestamp field using day granularity. HOUR - Partitions data on a timestamp field using hour granularity."
        }
      },
      "required": [
        "type"
      ]
    },
    "DataLakeDatasetPartitionSpec": {
      "type": "object",
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DataLakeDatasetPartitionField"
          },
          "description": "The fields on which to partition a dataset. The partitions will be applied hierarchically based on the order of this list."
        }
      },
      "required": [
        "fields"
      ]
    },
    "DataLakeDatasetPrimaryKeyField": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the primary key field."
        }
      },
      "required": [
        "name"
      ]
    },
    "DataLakeDatasetSchema": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the dataset schema."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DataLakeDatasetSchemaField"
          },
          "description": "The list of field details of the dataset schema."
        },
        "primaryKeys": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DataLakeDatasetPrimaryKeyField"
          },
          "description": "The list of primary key fields for the dataset. Primary keys defined can help data ingestion methods to ensure data uniqueness: CreateDataIntegrationFlow's dedupe strategy will leverage primary keys to perform records deduplication before write to dataset; SendDataIntegrationEvent's UPSERT and DELETE can only work with dataset with primary keys. For more details, refer to those data ingestion documentations. Note that defining primary keys does not necessarily mean the dataset cannot have duplicate records, duplicate records can still be ingested if CreateDataIntegrationFlow's dedupe disabled "
        }
      },
      "required": [
        "name",
        "fields"
      ]
    },
    "DataLakeDatasetSchemaField": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The dataset field name."
        },
        "type": {
          "type": "string",
          "enum": [
            "INT",
            "DOUBLE",
            "STRING",
            "TIMESTAMP",
            "LONG"
          ],
          "description": "The dataset field type."
        },
        "isRequired": {
          "type": "boolean",
          "description": "Indicate if the field is required or not."
        }
      },
      "required": [
        "name",
        "type",
        "isRequired"
      ]
    }
  }
}