Last active
November 3, 2025 00:33
-
-
Save lmmx/ed3dd70ea7997f27efa1ff31b625c0b1 to your computer and use it in GitHub Desktop.
tree-sitter-rust (v0.24.0) node types - Avro schema (https://docs.rs/tree-sitter-rust/latest/tree_sitter_rust/constant.NODE_TYPES.html), JSON schema, and some quick [not great quality] Serde structs (via https://app.quicktype.io/?l=rust)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fields: | |
| - name: node_types | |
| type: | |
| items: | |
| fields: | |
| - name: type | |
| type: string | |
| - name: named | |
| type: boolean | |
| - name: subtypes | |
| type: | |
| - 'null' | |
| - items: | |
| fields: | |
| - name: type | |
| type: string | |
| - name: named | |
| type: boolean | |
| name: subtypes | |
| namespace: genson.document_types.node_types_types | |
| type: record | |
| type: array | |
| - name: fields | |
| type: | |
| - 'null' | |
| - name: fields | |
| type: map | |
| values: | |
| fields: | |
| - name: multiple | |
| type: boolean | |
| - name: required | |
| type: boolean | |
| - name: types | |
| type: | |
| items: | |
| fields: | |
| - name: type | |
| type: string | |
| - name: named | |
| type: boolean | |
| name: types | |
| namespace: genson.document_types.node_types_types.fields_values_types | |
| type: record | |
| type: array | |
| name: fields_values | |
| namespace: genson.document_types.node_types_types | |
| type: record | |
| - name: children | |
| type: | |
| - 'null' | |
| - fields: | |
| - name: multiple | |
| type: boolean | |
| - name: required | |
| type: boolean | |
| - name: types | |
| type: | |
| items: | |
| fields: | |
| - name: type | |
| type: string | |
| - name: named | |
| type: boolean | |
| name: types | |
| namespace: genson.document_types.node_types_types.children_types | |
| type: record | |
| type: array | |
| name: children | |
| namespace: genson.document_types.node_types_types | |
| type: record | |
| - name: extra | |
| type: | |
| - 'null' | |
| - boolean | |
| - name: root | |
| type: | |
| - 'null' | |
| - boolean | |
| name: node_types | |
| namespace: genson.document_types | |
| type: record | |
| type: array | |
| name: document | |
| namespace: genson | |
| type: record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "record", | |
| "name": "document", | |
| "namespace": "genson", | |
| "fields": [ | |
| { | |
| "name": "node_types", | |
| "type": { | |
| "type": "array", | |
| "items": { | |
| "type": "record", | |
| "name": "node_types", | |
| "namespace": "genson.document_types", | |
| "fields": [ | |
| { | |
| "name": "type", | |
| "type": "string" | |
| }, | |
| { | |
| "name": "named", | |
| "type": "boolean" | |
| }, | |
| { | |
| "name": "subtypes", | |
| "type": [ | |
| "null", | |
| { | |
| "type": "array", | |
| "items": { | |
| "type": "record", | |
| "name": "subtypes", | |
| "namespace": "genson.document_types.node_types_types", | |
| "fields": [ | |
| { | |
| "name": "type", | |
| "type": "string" | |
| }, | |
| { | |
| "name": "named", | |
| "type": "boolean" | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "fields", | |
| "type": [ | |
| "null", | |
| { | |
| "name": "fields", | |
| "type": "map", | |
| "values": { | |
| "type": "record", | |
| "name": "fields_values", | |
| "namespace": "genson.document_types.node_types_types", | |
| "fields": [ | |
| { | |
| "name": "multiple", | |
| "type": "boolean" | |
| }, | |
| { | |
| "name": "required", | |
| "type": "boolean" | |
| }, | |
| { | |
| "name": "types", | |
| "type": { | |
| "type": "array", | |
| "items": { | |
| "type": "record", | |
| "name": "types", | |
| "namespace": "genson.document_types.node_types_types.fields_values_types", | |
| "fields": [ | |
| { | |
| "name": "type", | |
| "type": "string" | |
| }, | |
| { | |
| "name": "named", | |
| "type": "boolean" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "children", | |
| "type": [ | |
| "null", | |
| { | |
| "type": "record", | |
| "name": "children", | |
| "namespace": "genson.document_types.node_types_types", | |
| "fields": [ | |
| { | |
| "name": "multiple", | |
| "type": "boolean" | |
| }, | |
| { | |
| "name": "required", | |
| "type": "boolean" | |
| }, | |
| { | |
| "name": "types", | |
| "type": { | |
| "type": "array", | |
| "items": { | |
| "type": "record", | |
| "name": "types", | |
| "namespace": "genson.document_types.node_types_types.children_types", | |
| "fields": [ | |
| { | |
| "name": "type", | |
| "type": "string" | |
| }, | |
| { | |
| "name": "named", | |
| "type": "boolean" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "extra", | |
| "type": [ | |
| "null", | |
| "boolean" | |
| ] | |
| }, | |
| { | |
| "name": "root", | |
| "type": [ | |
| "null", | |
| "boolean" | |
| ] | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use serde::{Serialize, Deserialize}; | |
| use std::collections::HashMap; | |
| #[derive(Serialize, Deserialize)] | |
| pub struct Coordinate { | |
| node_types: Vec<NodeType>, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct NodeType { | |
| children: Option<Children>, | |
| extra: Option<bool>, | |
| fields: Option<HashMap<String, Field>>, | |
| named: bool, | |
| root: Option<bool>, | |
| subtypes: Option<Vec<Subtype>>, | |
| #[serde(rename = "type")] | |
| node_type_type: String, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct Children { | |
| multiple: bool, | |
| required: bool, | |
| types: Vec<ChildrenType>, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct ChildrenType { | |
| named: bool, | |
| #[serde(rename = "type")] | |
| type_type: String, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct Field { | |
| multiple: bool, | |
| required: bool, | |
| types: Vec<FieldType>, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct FieldType { | |
| named: bool, | |
| #[serde(rename = "type")] | |
| type_type: String, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| pub struct Subtype { | |
| named: bool, | |
| #[serde(rename = "type")] | |
| subtype_type: String, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment