Skip to content

author: declare a source's own fields once, as a schema a model can be shown #230

Closed

Description

@alekswebnet

A source's own fields (type, title, language, license, licenseVersion, authors, source, yearFrom, yearTo, params) are written down three times:

  • checked by hand in sourceOf;
  • typed by a separate Source typedef;
  • described to a model only in prose (SOURCE_FIELDS).

The MCP server (#227) takes h5p_build's source as any object, so a model sees no shape until a build refuses one. In Claude Code, Haiku's first Question Set build through the server was refused for authors: ["Unknown"].

Proposal

One schema for a source's own fields, sourceSchema, exported by the author package:

  • sourceOf holds each field to it. The messages stay as they are, and every problem of an author is said at once. An author written as a name alone is said with the object to write.
  • The Source type is its output.
  • The MCP server shows it as JSON Schema for h5p_build's source. The server still leaves the checking to the build, so no source is refused before the build has listed everything it finds (h5p-author: a chat with no skill text spends a round on each layer of a source's outer shape #174).

What stays in code: what one field cannot say alone stays in sourceOf. That is a content type named loosely, a licence written with its version, a version for a licence that takes none, and fields in the wrong place.

zod/mini, not zod: a build runs in a page too. With zod/mini the schema adds 23 kB minified; zod's chained API adds 93 kB.

Not in scope: a content's fields (params), which are held to each library's semantics.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions