Repository navigation
Leave the explicit type key to the collection in starter types - #14
Merged
Merged
Conversation
Apps create records by naming a type, and the engine records it under the collection's configured explicit_type_keys. The Person, Comment and View starters also required `type` and pinned it to their own name, so their records failed validation (schema_required: type) in any collection whose key is not `type`, such as Reader collections that use `mdbase_type` because `type` holds citation data. View's closed top-level schema also rejected whichever key it did not declare. Person v3, Comment v2 and View v2 drop the pinned `type` property, and View v2 accepts unknown top-level fields. Each keeps its match rule so hand-written `type: <name>` records are still recognised. mdbase.contact 1.3.0, mdbase.comment 1.0.1 and mdbase.view 1.0.1 ship them with upgrade_from the previous starter, and the superseded packs are hidden from the catalog with their provisions byte-identical. A new test guards every current starter.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apps create records by naming a type (
create({ type: "person", … })), and the engine records it under the collection's configuredsettings.explicit_type_keys:typeby default, but e.g.mdbase_typein Reader collections wheretypeholds CSL data. Three starters also requiredtypeand pinned it to their own name, so their records fail validation in any collection whose key is something else:View's closed top-level schema (
additionalProperties: false) additionally rejected whichever key it did not declare, so no View type file could work under both keys.Changes
types/person/3.md,types/comment/2.md,types/view/2.md: drop the pinnedtypeproperty and itsrequiredentry. View v2's top level accepts unknown fields (nested query-language objects stay strict). Each keepsmatch: where: type: <name>so hand-writtentype: <name>records are still recognised, including in collections without explicit keys.mdbase.contact1.3.0,mdbase.comment1.0.1,mdbase.view1.0.1 ship them withupgrade_fromthe previous starter, so an unmodified installed seed is offered a reviewed upgrade. The superseded packs arevisibility: hidden; their provisions stay byte-identical tomain(contact1.2.0 is now asserted alongside 1.0.0/1.1.0).scripts/starter-type-keys.test.mjs: every current starter leavestype/typesundeclared and unrequired and is not closed at the top level.type, or withmdbase_type, is valid. The People install matrix adds1.3.0and1.2.0 → 1.3.0.Behaviour (mdbase CLI, person starter)
explicit_type_keystype: person[type, types][mdbase_type]match)[]Not in this PR
runtime_*types are synced from the spec's standard packs, are closed, and their contracts map a contract field totype; that needs a contract-level decision.contactv2 is no longer installed by any offered pack.Verification
npm testwithMDBASE_VERIFY_CLI(mdbase 0.1.0-beta.120): 27 unit tests and 42 pack tests pass, including CLI dry run, install and repeat assessment of every catalog pack.