Skip to content

Instantly share code, notes, and snippets.

@agoose77
Last active August 9, 2023 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agoose77/840e41cda65559f0f8dd51c69b4e3da9 to your computer and use it in GitHub Desktop.
Save agoose77/840e41cda65559f0f8dd51c69b4e3da9 to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Awkward Array Form Schema",
"definitions": {
"Primitive": {
"oneOf": [
{
"type": "string",
"enum": [
"bool",
"int8",
"uint8",
"int16",
"uint16",
"int32",
"uint32",
"int64",
"uint64",
"float32",
"float64",
"complex64",
"complex128",
"float16",
"float128",
"complex256"
]
},
{
"type": "string",
"pattern": "(datetime|timedelta)64\\[\\w+\\]"
}
]
},
"Index": {
"type": "string",
"enum": [
"i8",
"u8",
"i32",
"u32",
"i64"
]
},
"BaseForm": {
"type": "object",
"properties": {
"class": {
"type": "string"
},
"form_key": {
"type": "string"
},
"parameters": {
"type": "object"
}
},
"required": [
"class"
]
},
"NumpyForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "NumpyArray"
},
"primitive": {
"$ref": "#/definitions/Primitive"
},
"inner_shape": {
"type": "array",
"items": {
"type": "integer"
}
}
},
"required": [
"primitive"
]
},
"EmptyForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "EmptyArray"
}
}
},
"BitMaskedForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "BitMaskedArray"
},
"mask": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"mask",
"content"
]
},
"ByteMaskedForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "ByteMaskedArray"
},
"mask": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"mask",
"content"
]
},
"IndexedForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "IndexedArray"
},
"index": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"index",
"content"
]
},
"IndexedOptionForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "IndexedOptionArray"
},
"index": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"index",
"content"
]
},
"ListForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "ListArray"
},
"starts": {
"$ref": "#/definitions/Index"
},
"stops": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"starts",
"stops",
"content"
]
},
"ListOffsetForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "ListOffsetArray"
},
"offsets": {
"$ref": "#/definitions/Index"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"offsets",
"content"
]
},
"RegularForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "RegularArray"
},
"content": {
"$ref": "#/definitions/Form"
},
"size": {
"type": "integer"
}
},
"required": [
"size",
"content"
]
},
"RecordForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "RecordArray"
},
"contents": {
"type": "array",
"items": {
"$ref": "#/definitions/Form"
}
},
"fields": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
}
},
"required": [
"contents",
"fields"
]
},
"UnionForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "UnionArray"
},
"tags": {
"$ref": "#/definitions/Index"
},
"index": {
"$ref": "#/definitions/Index"
},
"contents": {
"type": "array",
"items": {
"$ref": "#/definitions/Form"
}
}
},
"required": [
"tags",
"index",
"contents"
]
},
"UnmaskedForm": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/BaseForm"
}
],
"properties": {
"class": {
"const": "UnmaskedArray"
},
"content": {
"$ref": "#/definitions/Form"
}
},
"required": [
"content"
]
},
"Form": {
"type": "object",
"oneOf": [
{
"$ref": "#/definitions/BitMaskedForm"
},
{
"$ref": "#/definitions/ByteMaskedForm"
},
{
"$ref": "#/definitions/EmptyForm"
},
{
"$ref": "#/definitions/IndexedForm"
},
{
"$ref": "#/definitions/IndexedOptionForm"
},
{
"$ref": "#/definitions/ListForm"
},
{
"$ref": "#/definitions/ListOffsetForm"
},
{
"$ref": "#/definitions/NumpyForm"
},
{
"$ref": "#/definitions/RecordForm"
},
{
"$ref": "#/definitions/RegularForm"
},
{
"$ref": "#/definitions/UnionForm"
},
{
"$ref": "#/definitions/UnmaskedForm"
}
]
}
},
"$ref": "#/definitions/Form"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment