Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local and head manifest schemas #2379

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
160 changes: 160 additions & 0 deletions packages/manifest/head.bbm.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"$id": "https://raw.githubusercontent.com/breadboard-ai/breadboard/main/packages/manifest/bbm.schema.json",
"$ref": "#/definitions/BreadboardManifest",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"Board": {
"$ref": "https://raw.githubusercontent.com/breadboard-ai/breadboard/main/schema/breadboard.schema.json#/definitions/GraphDescriptor",
"description": "A reference to the BGL schema GraphDescriptor type.",
"type": "object"
},
"BoardReference": {
"anyOf": [
{
"$ref": "#/definitions/ResourceReference"
},
{
"$ref": "#/definitions/Board"
}
],
"description": "Union of {@link ResourceReference } and {@link Board }"
},
"BreadboardManifest": {
"additionalProperties": false,
"description": "A Breadboard Manifest.\n\nContains references to boards and other manifests.",
"examples": [
{
"title": "Empty Manifest"
},
{
"boards": [],
"manifests": [],
"title": "Manifest with empty lists"
},
{
"boards": [
{
"title": "My First Board",
"url": "https://gist.githubusercontent.com/user/SOME_ID/raw/board.bgl.json",
"version": "1.0.0"
},
{
"title": "My Second Board",
"url": "./boards/board.bgl.json"
}
],
"manifests": [
{
"title": "Gist Manifest",
"url": "https://gist.githubusercontent.com/user/SOME_ID/raw/manifest.bbm.json"
}
]
},
{
"boards": [
{
"edges": [],
"nodes": [],
"title": "My First Board"
}
],
"title": "Manifest with concrete boards"
}
],
"properties": {
"$schema": {
"$ref": "#/definitions/Reference"
},
"boards": {
"items": {
"$ref": "#/definitions/BoardReference"
},
"type": "array"
},
"manifests": {
"items": {
"$ref": "#/definitions/ManifestReference"
},
"type": "array"
},
"reference": {
"$ref": "#/definitions/Reference"
},
"title": {
"$ref": "#/definitions/Title"
}
},
"type": "object"
},
"ManifestReference": {
"anyOf": [
{
"$ref": "#/definitions/ResourceReference"
},
{
"$ref": "#/definitions/BreadboardManifest"
}
],
"description": "Union of {@link ResourceReference } and {@link BreadboardManifest }"
},
"Reference": {
"anyOf": [
{
"$ref": "#/definitions/UriReference"
},
{
"$ref": "#/definitions/RelativeReference"
}
],
"description": "A reference to a resource."
},
"RelativeReference": {
"description": "A reference to a resource relative to the Uri of the parent resource.",
"examples": [
"../boards/board.bgl.json",
"../manifests/manifest.bbm.json",
"./board.bgl.json",
"./manifest.bbm.json",
"board.bgl.json",
"manifest.bbm.json"
],
"pattern": "^(\\.\\/|\\.\\.\\/|[a-zA-Z0-9_.-]+\\/)*[a-zA-Z0-9_.-]+$",
"type": "string"
},
"ResourceReference": {
"additionalProperties": false,
"description": "A resource that definitely has a reference.\n\nAlso has a title.",
"properties": {
"reference": {
"$ref": "#/definitions/Reference"
},
"title": {
"$ref": "#/definitions/Title"
}
},
"required": [
"reference"
],
"type": "object"
},
"Title": {
"examples": [
"Gist Manifest",
"My First Board"
],
"type": "string"
},
"UriReference": {
"description": "A URI reference.",
"examples": [
"file:///path/to/board.bgl.json",
"file:///path/to/manifest.bbm.json",
"https://example.com/board.bgl.json",
"https://example.com/manifest.bbm.json",
"https://example.com/manifests/manifest.bbm.json"
],
"format": "uri-reference",
"type": "string"
}
}
}
160 changes: 160 additions & 0 deletions packages/manifest/local.bbm.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"$id": "./local.bbm.schema.json",
"$ref": "#/definitions/BreadboardManifest",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"Board": {
"$ref": "../schema/breadboard.schema.json#/definitions/GraphDescriptor",
"description": "A reference to the BGL schema GraphDescriptor type.",
"type": "object"
},
"BoardReference": {
"anyOf": [
{
"$ref": "#/definitions/ResourceReference"
},
{
"$ref": "#/definitions/Board"
}
],
"description": "Union of {@link ResourceReference } and {@link Board }"
},
"BreadboardManifest": {
"additionalProperties": false,
"description": "A Breadboard Manifest.\n\nContains references to boards and other manifests.",
"examples": [
{
"title": "Empty Manifest"
},
{
"boards": [],
"manifests": [],
"title": "Manifest with empty lists"
},
{
"boards": [
{
"title": "My First Board",
"url": "https://gist.githubusercontent.com/user/SOME_ID/raw/board.bgl.json",
"version": "1.0.0"
},
{
"title": "My Second Board",
"url": "./boards/board.bgl.json"
}
],
"manifests": [
{
"title": "Gist Manifest",
"url": "https://gist.githubusercontent.com/user/SOME_ID/raw/manifest.bbm.json"
}
]
},
{
"boards": [
{
"edges": [],
"nodes": [],
"title": "My First Board"
}
],
"title": "Manifest with concrete boards"
}
],
"properties": {
"$schema": {
"$ref": "#/definitions/Reference"
},
"boards": {
"items": {
"$ref": "#/definitions/BoardReference"
},
"type": "array"
},
"manifests": {
"items": {
"$ref": "#/definitions/ManifestReference"
},
"type": "array"
},
"reference": {
"$ref": "#/definitions/Reference"
},
"title": {
"$ref": "#/definitions/Title"
}
},
"type": "object"
},
"ManifestReference": {
"anyOf": [
{
"$ref": "#/definitions/ResourceReference"
},
{
"$ref": "#/definitions/BreadboardManifest"
}
],
"description": "Union of {@link ResourceReference } and {@link BreadboardManifest }"
},
"Reference": {
"anyOf": [
{
"$ref": "#/definitions/UriReference"
},
{
"$ref": "#/definitions/RelativeReference"
}
],
"description": "A reference to a resource."
},
"RelativeReference": {
"description": "A reference to a resource relative to the Uri of the parent resource.",
"examples": [
"../boards/board.bgl.json",
"../manifests/manifest.bbm.json",
"./board.bgl.json",
"./manifest.bbm.json",
"board.bgl.json",
"manifest.bbm.json"
],
"pattern": "^(\\.\\/|\\.\\.\\/|[a-zA-Z0-9_.-]+\\/)*[a-zA-Z0-9_.-]+$",
"type": "string"
},
"ResourceReference": {
"additionalProperties": false,
"description": "A resource that definitely has a reference.\n\nAlso has a title.",
"properties": {
"reference": {
"$ref": "#/definitions/Reference"
},
"title": {
"$ref": "#/definitions/Title"
}
},
"required": [
"reference"
],
"type": "object"
},
"Title": {
"examples": [
"Gist Manifest",
"My First Board"
],
"type": "string"
},
"UriReference": {
"description": "A URI reference.",
"examples": [
"file:///path/to/board.bgl.json",
"file:///path/to/manifest.bbm.json",
"https://example.com/board.bgl.json",
"https://example.com/manifest.bbm.json",
"https://example.com/manifests/manifest.bbm.json"
],
"format": "uri-reference",
"type": "string"
}
}
}
6 changes: 4 additions & 2 deletions packages/manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"./*": [
"./dist/*"
],
"./bbm.schema.json": "./bbm.schema.json"
"./bbm.schema.json": "./bbm.schema.json",
"./head.bbm.schema.json": "./head.bbm.schema.json",
"./local.bbm.schema.json": "./local.bbm.schema.json"
},
"files": [
"**/*.ts",
Expand Down Expand Up @@ -67,7 +69,7 @@
"../../core/tsconfig/base.json"
],
"output": [
"bbm.schema.json"
"*.schema.json"
]
},
"build:ts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/manifest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export type Reference = UriReference | RelativeReference;
*
* Also has a title.
*/
export interface ResourceReference extends Resource {
export interface ResourceReference extends Resource, Partial<GraphDescriptor> {
readonly reference: Reference;
readonly title?: Title;
readonly tags?: Tags;
Expand Down
Loading
Loading