{
"id": "science.alt.dataset.schema",
"defs": {
"main": {
"key": "any",
"type": "record",
"record": {
"type": "object",
"required": [
"name",
"version",
"schemaType",
"schema",
"createdAt"
],
"properties": {
"name": {
"type": "string",
"maxLength": 100,
"description": "Human-readable display name for this sample type. Used for documentation and UI. The NSID in the record URI provides unique identification; name collisions across NSIDs are acceptable."
},
"schema": {
"refs": [
"science.alt.dataset.schema#jsonSchemaFormat"
],
"type": "union",
"closed": false,
"description": "Schema definition for this sample type. Currently supports JSON Schema Draft 7. Union allows for future schema formats (Avro, Protobuf, etc.) without breaking changes."
},
"version": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
"maxLength": 100,
"description": "Semantic version (e.g., '1.0.0')"
},
"metadata": {
"ref": "#schemaMetadata",
"type": "ref",
"description": "Optional metadata about this schema. Common fields include license and tags, but any additional fields are permitted."
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "Timestamp when this schema version was created. Immutable once set (ATProto records are permanent)."
},
"schemaType": {
"ref": "science.alt.dataset.schemaType",
"type": "ref",
"description": "Type of schema definition. This field indicates which union member is present in the schema field."
},
"description": {
"type": "string",
"maxLength": 5000,
"description": "Human-readable description of what this sample type represents"
},
"$atdataSchemaVersion": {
"type": "integer",
"minimum": 1,
"description": "Format version discriminator for the schema record itself. Used to detect breaking changes in the record structure. When absent, treated as version 1 for backward compatibility."
}
}
},
"description": "Definition of a PackableSample-compatible sample type. Supports versioning via rkey format: {NSID}@{semver}. Schema format is extensible via union type."
},
"schemaMetadata": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string",
"maxLength": 150
},
"maxLength": 30,
"description": "Categorization keywords for discovery. Aligns with Schema.org keywords property."
},
"license": {
"type": "string",
"maxLength": 200,
"description": "License identifier or URL. SPDX identifiers recommended (e.g., MIT, Apache-2.0, CC-BY-4.0) or full SPDX URLs (e.g., http://spdx.org/licenses/MIT). Aligns with Schema.org license property."
}
},
"description": "Open metadata object for schema records. Common fields include license and tags. Applications may extend with additional fields."
},
"jsonSchemaFormat": {
"type": "object",
"required": [
"draft",
"content"
],
"properties": {
"draft": {
"type": "string",
"const": "draft-07",
"description": "JSON Schema draft version identifier"
},
"content": {
"type": "unknown",
"description": "JSON Schema object (e.g., Draft 7). Contains the full schema including $schema, type, properties, etc. Stored as opaque data to avoid $-prefix collisions with ATProto reserved fields."
},
"arrayFormatVersions": {
"type": "unknown",
"description": "Mapping from array format identifiers to semantic versions. Keys are science.alt.dataset.arrayFormat values (e.g., 'ndarrayBytes'), values are semver strings (e.g., '1.0.0'). Canonical shim schemas are maintained at https://json-schema.alt.science/atdata-{format}/{version}/."
}
},
"description": "JSON Schema format for sample type definitions. The content field holds the actual JSON Schema document (Draft 7+). This envelope separates ATProto protocol fields from JSON Schema's $-prefixed fields."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}