Created
March 27, 2021 13:30
-
-
Save petejohanson/e931f15b8545c3c2469b9fa5ca456a13 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import Layout from '@theme/Layout'; | |
import { HardwareMetadata } from "../hardware-metadata"; | |
function HardwareList(metadata: HardwareMetadata[]) { | |
return ( | |
<Layout title="Hello"> | |
{metadata.map(hm => <li>{hm.id}</li>)} | |
</Layout> | |
); | |
} | |
export default HardwareList; |
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
{ | |
"$id": "https://zmkfirmware.dev/zmk.metadata.json", | |
"title": "HardwareMetadata", | |
"$schema": "https://json-schema.org/draft/2020-12/schema", | |
"oneOf": [ | |
{ "$ref": "#/$defs/board" }, | |
{ "$ref": "#/$defs/shield" } | |
], | |
"$defs": { | |
"id": { "type": "string", "pattern": "^[a-z0-9_]+$" }, | |
"keyboard_parts": { | |
"type": "array", | |
"items": { | |
"oneOf": [ | |
{ "type": "string" }, | |
{ "$ref": "#/$defs/part_details" } | |
] | |
} | |
}, | |
"variant": { | |
"oneOf": [ | |
{ "type": "string" }, | |
{ | |
"type": "object", | |
"required": [ "id", "features" ], | |
"properties": { | |
"id": { "$ref": "#/$defs/id" }, | |
"features": { "$ref": "#/$defs/features" } | |
} | |
} | |
] | |
}, | |
"features": { | |
"type": "array", | |
"items": { | |
"type": "string", | |
"enum": [ "display", "encoder" ] | |
} | |
}, | |
"interconnects": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"type": "string", | |
"minLength": 1 | |
} | |
}, | |
"part_details": { | |
"type": "object", | |
"additionalProperties": false, | |
"properties": { | |
"id": { "$ref": "#/$defs/id" }, | |
"features": { "$ref": "#/$defs/features" }, | |
"variants": { | |
"type": "array", | |
"items": { "$ref": "#/$defs/variant" } | |
} | |
} | |
}, | |
"board": { | |
"title": "Board", | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ "id", "name", "url", "arch", "type", "outputs" ], | |
"properties": { | |
"id": { "$ref": "#/$defs/id" }, | |
"name": { "type": "string" }, | |
"version": { "type": "string" }, | |
"url": { "type": "string", "format": "uri" }, | |
"manufacturer": { "type": "string" }, | |
"arch": { "type": "string", "pattern": "^[a-z0-9_]+$" }, | |
"type": { | |
"type": "string", | |
"enum": [ "mcu", "keyboard" ] | |
}, | |
"parts": { "$ref": "#/$defs/keyboard_parts" }, | |
"outputs": { | |
"type": "array", | |
"items": { | |
"type": "string", | |
"enum": [ "usb", "ble" ] | |
} | |
}, | |
"features": { "$ref": "#/$defs/features" }, | |
"variants": { | |
"type": "array", | |
"items": { "$ref": "#/$defs/variant" } | |
}, | |
"interconnects": { "$ref": "#/$defs/interconnects" } | |
} | |
}, | |
"shield": { | |
"title": "Shield", | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ "id", "name", "url", "type", "interconnects" ], | |
"properties": { | |
"id": { "$ref": "#/$defs/id" }, | |
"name": { "type": "string" }, | |
"url": { "type": "string", "format": "uri" }, | |
"manufacturer": { "type": "string" }, | |
"version": { "type": "string" }, | |
"type": { | |
"type": "string", | |
"const": "shield" | |
}, | |
"features": { "$ref": "#/$defs/features" }, | |
"variants": { | |
"type": "array", | |
"items": { "$ref": "#/$defs/variant" } | |
}, | |
"parts": { "$ref": "#/$defs/keyboard_parts" }, | |
"interconnects": { "$ref": "#/$defs/interconnects" } | |
} | |
} | |
} | |
} |
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
/* tslint:disable */ | |
/** | |
* This file was automatically generated by json-schema-to-typescript. | |
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | |
* and run json-schema-to-typescript to regenerate this file. | |
*/ | |
export type HardwareMetadata = Board | Shield; | |
export type Id = string; | |
export type Features = ("display" | "encoder")[]; | |
export type Variant = | |
| string | |
| { | |
id: Id; | |
features: Features; | |
[k: string]: unknown; | |
}; | |
export type KeyboardParts = (string | PartDetails)[]; | |
export type Interconnects = [string, ...string[]]; | |
export interface Board { | |
id: Id; | |
name: string; | |
version?: string; | |
url: string; | |
manufacturer?: string; | |
arch: string; | |
type: "mcu" | "keyboard"; | |
parts?: KeyboardParts; | |
outputs: ("usb" | "ble")[]; | |
features?: Features; | |
variants?: Variant[]; | |
interconnects?: Interconnects; | |
} | |
export interface PartDetails { | |
id?: Id; | |
features?: Features; | |
variants?: Variant[]; | |
} | |
export interface Shield { | |
id: Id; | |
name: string; | |
url: string; | |
manufacturer?: string; | |
version?: string; | |
type: "shield"; | |
features?: Features; | |
variants?: Variant[]; | |
parts?: KeyboardParts; | |
interconnects: Interconnects; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment