From 5ca6a6581252b11bb11092f24a0f27e5d16651dd Mon Sep 17 00:00:00 2001 From: Ewen Le Bihan Date: Sat, 13 Apr 2024 00:45:57 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Release=20v0.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 + README.md | 2 +- meta.go | 2 +- packages/python/ortfodb/database.py | 400 +++++++++++++++++++++++++--- packages/python/pyproject.toml | 2 +- packages/rust/Cargo.toml | 2 +- packages/rust/src/database.rs | 153 ++++++++++- packages/typescript/package.json | 2 +- packages/typescript/src/database.ts | 175 ++++++++++-- schemas/configuration.schema.json | 2 +- schemas/database.schema.json | 35 ++- schemas/tags.schema.json | 2 +- schemas/technologies.schema.json | 2 +- 13 files changed, 705 insertions(+), 79 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20393fd..b0aab0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.2] - 2024-04-13 + ### Fixed - replace meta-work in database with a databaseMetadata field on all works' metadata. client libraries should be able to generate properly from the resulting, simpler JSON schema. @@ -31,8 +33,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release [Unreleased]: https://github.com/ortfo/db/compare/v0.3.1...HEAD +[0.3.2]: https://github.com/ortfo/db/-/releases/tag/v0.3.2 [0.3.1]: https://github.com/ortfo/db/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/ortfo/db/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/ortfo/db/releases/tag/v0.2.0 [//]: # (C3-2-DKAC:GGH:Rortfo/db:Tv{t}) + +[unreleased]: https://github.com/ortfo/db/-/compare/v0.3.2...main diff --git a/README.md b/README.md index 6ab26a8..0b50d66 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ See [Compiling](#compiling) for instructions on how to compile this yourself ## Usage ```docopt -ortfo/db v0.3.1 +ortfo/db v0.3.2 Usage: ortfodb [options] build to [--config=FILEPATH] [-msS] [--] diff --git a/meta.go b/meta.go index 32f7a09..8b2860f 100644 --- a/meta.go +++ b/meta.go @@ -1,3 +1,3 @@ package ortfodb -const Version = "0.3.1" +const Version = "0.3.2" diff --git a/packages/python/ortfodb/database.py b/packages/python/ortfodb/database.py index 81e0af8..9605b7a 100644 --- a/packages/python/ortfodb/database.py +++ b/packages/python/ortfodb/database.py @@ -1,4 +1,4 @@ -from typing import Optional, Any, TypeVar, Type, cast +from typing import Any, List, Dict, TypeVar, Type, cast, Callable T = TypeVar("T") @@ -9,18 +9,24 @@ def from_bool(x: Any) -> bool: return x -def from_none(x: Any) -> Any: - assert x is None +def from_str(x: Any) -> str: + assert isinstance(x, str) return x -def from_union(fs, x): - for f in fs: - try: - return f(x) - except: - pass - assert False +def from_float(x: Any) -> float: + assert isinstance(x, (float, int)) and not isinstance(x, bool) + return float(x) + + +def from_int(x: Any) -> int: + assert isinstance(x, int) and not isinstance(x, bool) + return x + + +def to_float(x: Any) -> float: + assert isinstance(x, float) + return x def to_class(c: Type[T], x: Any) -> dict: @@ -28,47 +34,379 @@ def to_class(c: Type[T], x: Any) -> dict: return cast(Any, x).to_dict() -class Meta: - partial: Optional[bool] +def from_list(f: Callable[[Any], T], x: Any) -> List[T]: + assert isinstance(x, list) + return [f(y) for y in x] + + +def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: + assert isinstance(x, dict) + return { k: f(v) for (k, v) in x.items() } + + +class Attributes: + autoplay: bool + controls: bool + loop: bool + muted: bool + playsinline: bool + + def __init__(self, autoplay: bool, controls: bool, loop: bool, muted: bool, playsinline: bool) -> None: + self.autoplay = autoplay + self.controls = controls + self.loop = loop + self.muted = muted + self.playsinline = playsinline + + @staticmethod + def from_dict(obj: Any) -> 'Attributes': + assert isinstance(obj, dict) + autoplay = from_bool(obj.get("autoplay")) + controls = from_bool(obj.get("controls")) + loop = from_bool(obj.get("loop")) + muted = from_bool(obj.get("muted")) + playsinline = from_bool(obj.get("playsinline")) + return Attributes(autoplay, controls, loop, muted, playsinline) + + def to_dict(self) -> dict: + result: dict = {} + result["autoplay"] = from_bool(self.autoplay) + result["controls"] = from_bool(self.controls) + result["loop"] = from_bool(self.loop) + result["muted"] = from_bool(self.muted) + result["playsinline"] = from_bool(self.playsinline) + return result + + +class Colors: + primary: str + secondary: str + tertiary: str + + def __init__(self, primary: str, secondary: str, tertiary: str) -> None: + self.primary = primary + self.secondary = secondary + self.tertiary = tertiary + + @staticmethod + def from_dict(obj: Any) -> 'Colors': + assert isinstance(obj, dict) + primary = from_str(obj.get("primary")) + secondary = from_str(obj.get("secondary")) + tertiary = from_str(obj.get("tertiary")) + return Colors(primary, secondary, tertiary) + + def to_dict(self) -> dict: + result: dict = {} + result["primary"] = from_str(self.primary) + result["secondary"] = from_str(self.secondary) + result["tertiary"] = from_str(self.tertiary) + return result + + +class Dimensions: + aspect_ratio: float + height: int + width: int + + def __init__(self, aspect_ratio: float, height: int, width: int) -> None: + self.aspect_ratio = aspect_ratio + self.height = height + self.width = width + + @staticmethod + def from_dict(obj: Any) -> 'Dimensions': + assert isinstance(obj, dict) + aspect_ratio = from_float(obj.get("aspectRatio")) + height = from_int(obj.get("height")) + width = from_int(obj.get("width")) + return Dimensions(aspect_ratio, height, width) + + def to_dict(self) -> dict: + result: dict = {} + result["aspectRatio"] = to_float(self.aspect_ratio) + result["height"] = from_int(self.height) + result["width"] = from_int(self.width) + return result + + +class Thumbnails: + pass + + def __init__(self, ) -> None: + pass - def __init__(self, partial: Optional[bool]) -> None: + @staticmethod + def from_dict(obj: Any) -> 'Thumbnails': + assert isinstance(obj, dict) + return Thumbnails() + + def to_dict(self) -> dict: + result: dict = {} + return result + + +class BlockElement: + alt: str + analyzed: bool + anchor: str + attributes: Attributes + caption: str + colors: Colors + content: str + content_type: str + dimensions: Dimensions + dist_source: str + duration: float + has_sound: bool + id: str + index: int + online: bool + relative_source: str + size: int + text: str + thumbnails: Thumbnails + thumbnails_built_at: str + title: str + type: str + url: str + + def __init__(self, alt: str, analyzed: bool, anchor: str, attributes: Attributes, caption: str, colors: Colors, content: str, content_type: str, dimensions: Dimensions, dist_source: str, duration: float, has_sound: bool, id: str, index: int, online: bool, relative_source: str, size: int, text: str, thumbnails: Thumbnails, thumbnails_built_at: str, title: str, type: str, url: str) -> None: + self.alt = alt + self.analyzed = analyzed + self.anchor = anchor + self.attributes = attributes + self.caption = caption + self.colors = colors + self.content = content + self.content_type = content_type + self.dimensions = dimensions + self.dist_source = dist_source + self.duration = duration + self.has_sound = has_sound + self.id = id + self.index = index + self.online = online + self.relative_source = relative_source + self.size = size + self.text = text + self.thumbnails = thumbnails + self.thumbnails_built_at = thumbnails_built_at + self.title = title + self.type = type + self.url = url + + @staticmethod + def from_dict(obj: Any) -> 'BlockElement': + assert isinstance(obj, dict) + alt = from_str(obj.get("alt")) + analyzed = from_bool(obj.get("analyzed")) + anchor = from_str(obj.get("anchor")) + attributes = Attributes.from_dict(obj.get("attributes")) + caption = from_str(obj.get("caption")) + colors = Colors.from_dict(obj.get("colors")) + content = from_str(obj.get("content")) + content_type = from_str(obj.get("contentType")) + dimensions = Dimensions.from_dict(obj.get("dimensions")) + dist_source = from_str(obj.get("distSource")) + duration = from_float(obj.get("duration")) + has_sound = from_bool(obj.get("hasSound")) + id = from_str(obj.get("id")) + index = from_int(obj.get("index")) + online = from_bool(obj.get("online")) + relative_source = from_str(obj.get("relativeSource")) + size = from_int(obj.get("size")) + text = from_str(obj.get("text")) + thumbnails = Thumbnails.from_dict(obj.get("thumbnails")) + thumbnails_built_at = from_str(obj.get("thumbnailsBuiltAt")) + title = from_str(obj.get("title")) + type = from_str(obj.get("type")) + url = from_str(obj.get("url")) + return BlockElement(alt, analyzed, anchor, attributes, caption, colors, content, content_type, dimensions, dist_source, duration, has_sound, id, index, online, relative_source, size, text, thumbnails, thumbnails_built_at, title, type, url) + + def to_dict(self) -> dict: + result: dict = {} + result["alt"] = from_str(self.alt) + result["analyzed"] = from_bool(self.analyzed) + result["anchor"] = from_str(self.anchor) + result["attributes"] = to_class(Attributes, self.attributes) + result["caption"] = from_str(self.caption) + result["colors"] = to_class(Colors, self.colors) + result["content"] = from_str(self.content) + result["contentType"] = from_str(self.content_type) + result["dimensions"] = to_class(Dimensions, self.dimensions) + result["distSource"] = from_str(self.dist_source) + result["duration"] = to_float(self.duration) + result["hasSound"] = from_bool(self.has_sound) + result["id"] = from_str(self.id) + result["index"] = from_int(self.index) + result["online"] = from_bool(self.online) + result["relativeSource"] = from_str(self.relative_source) + result["size"] = from_int(self.size) + result["text"] = from_str(self.text) + result["thumbnails"] = to_class(Thumbnails, self.thumbnails) + result["thumbnailsBuiltAt"] = from_str(self.thumbnails_built_at) + result["title"] = from_str(self.title) + result["type"] = from_str(self.type) + result["url"] = from_str(self.url) + return result + + +class ContentValue: + blocks: List[BlockElement] + footnotes: Dict[str, str] + layout: List[List[str]] + title: str + + def __init__(self, blocks: List[BlockElement], footnotes: Dict[str, str], layout: List[List[str]], title: str) -> None: + self.blocks = blocks + self.footnotes = footnotes + self.layout = layout + self.title = title + + @staticmethod + def from_dict(obj: Any) -> 'ContentValue': + assert isinstance(obj, dict) + blocks = from_list(BlockElement.from_dict, obj.get("blocks")) + footnotes = from_dict(from_str, obj.get("footnotes")) + layout = from_list(lambda x: from_list(from_str, x), obj.get("layout")) + title = from_str(obj.get("title")) + return ContentValue(blocks, footnotes, layout, title) + + def to_dict(self) -> dict: + result: dict = {} + result["blocks"] = from_list(lambda x: to_class(BlockElement, x), self.blocks) + result["footnotes"] = from_dict(from_str, self.footnotes) + result["layout"] = from_list(lambda x: from_list(from_str, x), self.layout) + result["title"] = from_str(self.title) + return result + + +class DatabaseMetadataClass: + partial: bool + + def __init__(self, partial: bool) -> None: self.partial = partial @staticmethod - def from_dict(obj: Any) -> 'Meta': + def from_dict(obj: Any) -> 'DatabaseMetadataClass': + assert isinstance(obj, dict) + partial = from_bool(obj.get("Partial")) + return DatabaseMetadataClass(partial) + + def to_dict(self) -> dict: + result: dict = {} + result["Partial"] = from_bool(self.partial) + return result + + +class Metadata: + additional_metadata: Dict[str, Any] + aliases: List[str] + colors: Colors + database_metadata: DatabaseMetadataClass + finished: str + made_with: List[str] + page_background: str + private: bool + started: str + tags: List[str] + thumbnail: str + title_style: str + wip: bool + + def __init__(self, additional_metadata: Dict[str, Any], aliases: List[str], colors: Colors, database_metadata: DatabaseMetadataClass, finished: str, made_with: List[str], page_background: str, private: bool, started: str, tags: List[str], thumbnail: str, title_style: str, wip: bool) -> None: + self.additional_metadata = additional_metadata + self.aliases = aliases + self.colors = colors + self.database_metadata = database_metadata + self.finished = finished + self.made_with = made_with + self.page_background = page_background + self.private = private + self.started = started + self.tags = tags + self.thumbnail = thumbnail + self.title_style = title_style + self.wip = wip + + @staticmethod + def from_dict(obj: Any) -> 'Metadata': assert isinstance(obj, dict) - partial = from_union([from_bool, from_none], obj.get("Partial")) - return Meta(partial) + additional_metadata = from_dict(lambda x: x, obj.get("additionalMetadata")) + aliases = from_list(from_str, obj.get("aliases")) + colors = Colors.from_dict(obj.get("colors")) + database_metadata = DatabaseMetadataClass.from_dict(obj.get("databaseMetadata")) + finished = from_str(obj.get("finished")) + made_with = from_list(from_str, obj.get("madeWith")) + page_background = from_str(obj.get("pageBackground")) + private = from_bool(obj.get("private")) + started = from_str(obj.get("started")) + tags = from_list(from_str, obj.get("tags")) + thumbnail = from_str(obj.get("thumbnail")) + title_style = from_str(obj.get("titleStyle")) + wip = from_bool(obj.get("wip")) + return Metadata(additional_metadata, aliases, colors, database_metadata, finished, made_with, page_background, private, started, tags, thumbnail, title_style, wip) def to_dict(self) -> dict: result: dict = {} - if self.partial is not None: - result["Partial"] = from_union([from_bool, from_none], self.partial) + result["additionalMetadata"] = from_dict(lambda x: x, self.additional_metadata) + result["aliases"] = from_list(from_str, self.aliases) + result["colors"] = to_class(Colors, self.colors) + result["databaseMetadata"] = to_class(DatabaseMetadataClass, self.database_metadata) + result["finished"] = from_str(self.finished) + result["madeWith"] = from_list(from_str, self.made_with) + result["pageBackground"] = from_str(self.page_background) + result["private"] = from_bool(self.private) + result["started"] = from_str(self.started) + result["tags"] = from_list(from_str, self.tags) + result["thumbnail"] = from_str(self.thumbnail) + result["titleStyle"] = from_str(self.title_style) + result["wip"] = from_bool(self.wip) return result -class Database: - meta: Optional[Meta] +class DatabaseValue: + built_at: str + content: Dict[str, ContentValue] + description_hash: str + id: str + metadata: Metadata + partial: bool - def __init__(self, meta: Optional[Meta]) -> None: - self.meta = meta + def __init__(self, built_at: str, content: Dict[str, ContentValue], description_hash: str, id: str, metadata: Metadata, partial: bool) -> None: + self.built_at = built_at + self.content = content + self.description_hash = description_hash + self.id = id + self.metadata = metadata + self.partial = partial @staticmethod - def from_dict(obj: Any) -> 'Database': + def from_dict(obj: Any) -> 'DatabaseValue': assert isinstance(obj, dict) - meta = from_union([Meta.from_dict, from_none], obj.get("#meta")) - return Database(meta) + built_at = from_str(obj.get("builtAt")) + content = from_dict(ContentValue.from_dict, obj.get("content")) + description_hash = from_str(obj.get("descriptionHash")) + id = from_str(obj.get("id")) + metadata = Metadata.from_dict(obj.get("metadata")) + partial = from_bool(obj.get("Partial")) + return DatabaseValue(built_at, content, description_hash, id, metadata, partial) def to_dict(self) -> dict: result: dict = {} - if self.meta is not None: - result["#meta"] = from_union([lambda x: to_class(Meta, x), from_none], self.meta) + result["builtAt"] = from_str(self.built_at) + result["content"] = from_dict(lambda x: to_class(ContentValue, x), self.content) + result["descriptionHash"] = from_str(self.description_hash) + result["id"] = from_str(self.id) + result["metadata"] = to_class(Metadata, self.metadata) + result["Partial"] = from_bool(self.partial) return result -def database_from_dict(s: Any) -> Database: - return Database.from_dict(s) +def database_from_dict(s: Any) -> Dict[str, DatabaseValue]: + return from_dict(DatabaseValue.from_dict, s) -def database_to_dict(x: Database) -> Any: - return to_class(Database, x) +def database_to_dict(x: Dict[str, DatabaseValue]) -> Any: + return from_dict(lambda x: to_class(DatabaseValue, x), x) diff --git a/packages/python/pyproject.toml b/packages/python/pyproject.toml index b6d3de9..93e33c3 100644 --- a/packages/python/pyproject.toml +++ b/packages/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ortfodb" -version = "0.3.1" +version = "0.3.2" description = "ortfodb client library" authors = ["Ewen Le Bihan "] license = "MIT" diff --git a/packages/rust/Cargo.toml b/packages/rust/Cargo.toml index cc63728..374eeca 100644 --- a/packages/rust/Cargo.toml +++ b/packages/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ortfodb" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "An ortfodb (https://github.com/ortfo/db) client library for Rust." license = "MIT" diff --git a/packages/rust/src/database.rs b/packages/rust/src/database.rs index bc402f7..32ce226 100644 --- a/packages/rust/src/database.rs +++ b/packages/rust/src/database.rs @@ -12,15 +12,158 @@ // } use serde::{Serialize, Deserialize}; +use std::collections::HashMap; + +pub type Database = HashMap; + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DatabaseValue { + pub built_at: String, + + pub content: HashMap, + + pub description_hash: String, + + pub id: String, + + pub metadata: Metadata, + + #[serde(rename = "Partial")] + pub partial: bool, +} + +#[derive(Serialize, Deserialize)] +pub struct ContentValue { + pub blocks: Vec, + + pub footnotes: HashMap, + + pub layout: Vec>, + + pub title: String, +} + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct BlockElement { + pub alt: String, + + pub analyzed: bool, + + pub anchor: String, + + pub attributes: Attributes, + + pub caption: String, + + pub colors: Colors, + + pub content: String, + + pub content_type: String, + + pub dimensions: Dimensions, + + pub dist_source: String, + + pub duration: f64, + + pub has_sound: bool, + + pub id: String, + + pub index: i64, + + pub online: bool, + + pub relative_source: String, + + pub size: i64, + + pub text: String, + + pub thumbnails: Thumbnails, + + pub thumbnails_built_at: String, + + pub title: String, + + #[serde(rename = "type")] + pub database_schema_type: String, + + pub url: String, +} + +#[derive(Serialize, Deserialize)] +pub struct Attributes { + pub autoplay: bool, + + pub controls: bool, + + #[serde(rename = "loop")] + pub attributes_loop: bool, + + pub muted: bool, + + pub playsinline: bool, +} + +#[derive(Serialize, Deserialize)] +pub struct Colors { + pub primary: String, + + pub secondary: String, + + pub tertiary: String, +} + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Dimensions { + pub aspect_ratio: f64, + + pub height: i64, + + pub width: i64, +} #[derive(Serialize, Deserialize)] -pub struct Database { - #[serde(rename = "#meta")] - pub meta: Option, +pub struct Thumbnails { +} + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Metadata { + pub additional_metadata: HashMap>, + + pub aliases: Vec, + + pub colors: Colors, + + pub database_metadata: DatabaseMetadataClass, + + pub finished: String, + + pub made_with: Vec, + + pub page_background: String, + + pub private: bool, + + pub started: String, + + pub tags: Vec, + + pub thumbnail: String, + + pub title_style: String, + + pub wip: bool, } #[derive(Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct Meta { - pub partial: Option, +pub struct DatabaseMetadataClass { + pub partial: bool, } diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 80a1334..15c8c70 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@ortfo/db", - "version": "0.3.1", + "version": "0.3.2", "description": "ortfodb client library", "scripts": { "build": "tsc -p tsconfig.json --declaration --outDir dist" diff --git a/packages/typescript/src/database.ts b/packages/typescript/src/database.ts index 00e3175..6833f39 100644 --- a/packages/typescript/src/database.ts +++ b/packages/typescript/src/database.ts @@ -1,6 +1,6 @@ // To parse this data: // -// import { Convert, Database } from "./file"; +// import { Convert } from "./file"; // // const database = Convert.toDatabase(json); // @@ -8,24 +8,99 @@ // match the expected interface, even if the JSON is valid. export interface Database { - "#meta"?: Meta; - [property: string]: any; + builtAt: string; + content: { [key: string]: ContentValue }; + descriptionHash: string; + id: string; + metadata: Metadata; + Partial: boolean; } -export interface Meta { - Partial?: boolean; - [property: string]: any; +export interface ContentValue { + blocks: BlockElement[]; + footnotes: { [key: string]: string }; + layout: Array; + title: string; +} + +export interface BlockElement { + alt: string; + analyzed: boolean; + anchor: string; + attributes: Attributes; + caption: string; + colors: Colors; + content: string; + contentType: string; + dimensions: Dimensions; + distSource: string; + duration: number; + hasSound: boolean; + id: string; + index: number; + online: boolean; + relativeSource: string; + size: number; + text: string; + thumbnails: Thumbnails; + thumbnailsBuiltAt: string; + title: string; + type: string; + url: string; +} + +export interface Attributes { + autoplay: boolean; + controls: boolean; + loop: boolean; + muted: boolean; + playsinline: boolean; +} + +export interface Colors { + primary: string; + secondary: string; + tertiary: string; +} + +export interface Dimensions { + aspectRatio: number; + height: number; + width: number; +} + +export interface Thumbnails { +} + +export interface Metadata { + additionalMetadata: { [key: string]: any }; + aliases: string[]; + colors: Colors; + databaseMetadata: DatabaseMetadataClass; + finished: string; + madeWith: string[]; + pageBackground: string; + private: boolean; + started: string; + tags: string[]; + thumbnail: string; + titleStyle: string; + wip: boolean; +} + +export interface DatabaseMetadataClass { + Partial: boolean; } // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toDatabase(json: string): Database { - return cast(JSON.parse(json), r("Database")); + public static toDatabase(json: string): { [key: string]: Database } { + return cast(JSON.parse(json), m(r("Database"))); } - public static databaseToJson(value: Database): string { - return JSON.stringify(uncast(value, r("Database")), null, 2); + public static databaseToJson(value: { [key: string]: Database }): string { + return JSON.stringify(uncast(value, m(r("Database"))), null, 2); } } @@ -183,9 +258,79 @@ function r(name: string) { const typeMap: any = { "Database": o([ - { json: "#meta", js: "#meta", typ: u(undefined, r("Meta")) }, - ], "any"), - "Meta": o([ - { json: "Partial", js: "Partial", typ: u(undefined, true) }, - ], "any"), + { json: "builtAt", js: "builtAt", typ: "" }, + { json: "content", js: "content", typ: m(r("ContentValue")) }, + { json: "descriptionHash", js: "descriptionHash", typ: "" }, + { json: "id", js: "id", typ: "" }, + { json: "metadata", js: "metadata", typ: r("Metadata") }, + { json: "Partial", js: "Partial", typ: true }, + ], false), + "ContentValue": o([ + { json: "blocks", js: "blocks", typ: a(r("BlockElement")) }, + { json: "footnotes", js: "footnotes", typ: m("") }, + { json: "layout", js: "layout", typ: a(a("")) }, + { json: "title", js: "title", typ: "" }, + ], false), + "BlockElement": o([ + { json: "alt", js: "alt", typ: "" }, + { json: "analyzed", js: "analyzed", typ: true }, + { json: "anchor", js: "anchor", typ: "" }, + { json: "attributes", js: "attributes", typ: r("Attributes") }, + { json: "caption", js: "caption", typ: "" }, + { json: "colors", js: "colors", typ: r("Colors") }, + { json: "content", js: "content", typ: "" }, + { json: "contentType", js: "contentType", typ: "" }, + { json: "dimensions", js: "dimensions", typ: r("Dimensions") }, + { json: "distSource", js: "distSource", typ: "" }, + { json: "duration", js: "duration", typ: 3.14 }, + { json: "hasSound", js: "hasSound", typ: true }, + { json: "id", js: "id", typ: "" }, + { json: "index", js: "index", typ: 0 }, + { json: "online", js: "online", typ: true }, + { json: "relativeSource", js: "relativeSource", typ: "" }, + { json: "size", js: "size", typ: 0 }, + { json: "text", js: "text", typ: "" }, + { json: "thumbnails", js: "thumbnails", typ: r("Thumbnails") }, + { json: "thumbnailsBuiltAt", js: "thumbnailsBuiltAt", typ: "" }, + { json: "title", js: "title", typ: "" }, + { json: "type", js: "type", typ: "" }, + { json: "url", js: "url", typ: "" }, + ], false), + "Attributes": o([ + { json: "autoplay", js: "autoplay", typ: true }, + { json: "controls", js: "controls", typ: true }, + { json: "loop", js: "loop", typ: true }, + { json: "muted", js: "muted", typ: true }, + { json: "playsinline", js: "playsinline", typ: true }, + ], false), + "Colors": o([ + { json: "primary", js: "primary", typ: "" }, + { json: "secondary", js: "secondary", typ: "" }, + { json: "tertiary", js: "tertiary", typ: "" }, + ], false), + "Dimensions": o([ + { json: "aspectRatio", js: "aspectRatio", typ: 3.14 }, + { json: "height", js: "height", typ: 0 }, + { json: "width", js: "width", typ: 0 }, + ], false), + "Thumbnails": o([ + ], false), + "Metadata": o([ + { json: "additionalMetadata", js: "additionalMetadata", typ: m("any") }, + { json: "aliases", js: "aliases", typ: a("") }, + { json: "colors", js: "colors", typ: r("Colors") }, + { json: "databaseMetadata", js: "databaseMetadata", typ: r("DatabaseMetadataClass") }, + { json: "finished", js: "finished", typ: "" }, + { json: "madeWith", js: "madeWith", typ: a("") }, + { json: "pageBackground", js: "pageBackground", typ: "" }, + { json: "private", js: "private", typ: true }, + { json: "started", js: "started", typ: "" }, + { json: "tags", js: "tags", typ: a("") }, + { json: "thumbnail", js: "thumbnail", typ: "" }, + { json: "titleStyle", js: "titleStyle", typ: "" }, + { json: "wip", js: "wip", typ: true }, + ], false), + "DatabaseMetadataClass": o([ + { json: "Partial", js: "Partial", typ: true }, + ], false), }; diff --git a/schemas/configuration.schema.json b/schemas/configuration.schema.json index 7e230ac..b3f459f 100644 --- a/schemas/configuration.schema.json +++ b/schemas/configuration.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.1/schemas/configuration.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.2/schemas/configuration.schema.json", "$ref": "#/$defs/Configuration", "$defs": { "Configuration": { diff --git a/schemas/database.schema.json b/schemas/database.schema.json index 8372d86..ecdeef1 100644 --- a/schemas/database.schema.json +++ b/schemas/database.schema.json @@ -1,7 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.1/schemas/database.schema.json", - "$ref": "#/$defs/DatabaseWithMetaWork", + "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.2/schemas/database.schema.json", + "$ref": "#/$defs/Database", "$defs": { "AnalyzedWork": { "properties": { @@ -161,18 +161,17 @@ }, "type": "object" }, - "DatabaseWithMetaWork": { + "DatabaseMeta": { "properties": { - "#meta": { - "$ref": "#/$defs/MetaWork" - } - }, - "patternProperties": { - "^(?!#meta).*$": { - "$ref": "#/$defs/AnalyzedWork" + "Partial": { + "type": "boolean" } }, - "type": "object" + "additionalProperties": false, + "type": "object", + "required": [ + "Partial" + ] }, "Footnotes": { "additionalProperties": { @@ -270,14 +269,6 @@ "controls" ] }, - "MetaWork": { - "properties": { - "Partial": { - "type": "boolean" - } - }, - "type": "object" - }, "ThumbnailsMap": { "patternProperties": { "^[0-9]+$": { @@ -333,6 +324,9 @@ }, "additionalMetadata": { "type": "object" + }, + "databaseMetadata": { + "$ref": "#/$defs/DatabaseMeta" } }, "additionalProperties": false, @@ -349,7 +343,8 @@ "pageBackground", "wip", "private", - "additionalMetadata" + "additionalMetadata", + "databaseMetadata" ] } } diff --git a/schemas/tags.schema.json b/schemas/tags.schema.json index e8d0bba..5ce08e8 100644 --- a/schemas/tags.schema.json +++ b/schemas/tags.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.1/schemas/tags.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.2/schemas/tags.schema.json", "$ref": "#/$defs/tags", "$defs": { "Tag": { diff --git a/schemas/technologies.schema.json b/schemas/technologies.schema.json index de16efb..9eb29e6 100644 --- a/schemas/technologies.schema.json +++ b/schemas/technologies.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.1/schemas/technologies.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v0.3.2/schemas/technologies.schema.json", "$ref": "#/$defs/technologies", "$defs": { "Technology": {