format: correct schema examples and drop dead keywords#277
Open
gnidan wants to merge 1 commit into
Open
Conversation
Fixes example and prose defects found in the schema sweep: - type/base: struct example labeled members with `member:`; the canonical struct schema names that field `name:`. - pointer/collection/list: example read the loop index with `$read`, which reads bytes from a named region; the index is a scalar variable, so it is referenced bare as `offset: "index"`. - info/resources: the packed-struct pointer template sized its two uint128 members in bits (128) rather than bytes (16), pushing member y past the word boundary. - program/context/function/invoke: the inlined-call comment said the `transform` annotation rides along "typically via `gather`"; disjoint keys compose flat on one context object, so the comment now reflects that, and the near-duplicate example that added no distinct illustration is removed. - pointer/collection/scope: `define` validated its keys with an inline copy of the identifier pattern; it now references the identifier schema by `propertyNames` like its siblings. - type/definition: the description claimed no particular field was required, but the anyOf requires `name` or `location`; the prose now matches. - Dropped `additionalItems: false` where it is a no-op (removed in JSON Schema 2020-12, and inert when `items` is a single schema): program, info, pointer/template, program/context/gather, pick, and variables.
Contributor
|
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.
This PR corrects a set of example and prose defects surfaced by a sweep over the schemas. All are documentation- or validation-hygiene fixes; none change the accepted shape of any valid instance.
member:key, but the canonical struct schema (and every other example) names that fieldname:. No schema definesmember.{ $read: "index" }.$readreads bytes from a named region; the list index declared byeachis a scalar variable, referenced bare. Corrected tooffset: "index".uint128members as128(bits) instead of16(bytes), which put memberyat offset128, past the word boundary. Both members are now 16 bytes, packingxat offset 0 andyat offset 16 within one slot.transform: ["inline"]context accompanies the invoke "typically viagather".gatheris for colliding keys;invokeandtransformare disjoint and compose flat on one context object, and the comment now says so. The near-duplicate inlined-call example (identical heading and prose, no distinct illustration) is removed.definevalidated its keys with an inline copy of the identifier pattern; it now references the identifier schema viapropertyNames, matchingcollection/referenceandcollection/templatesso the pattern cannot silently drift.anyOfrequiresnameorlocation. The prose now matches the constraint.additionalItems: falseremoved where it is inert — the keyword was dropped in JSON Schema 2020-12 and, even under earlier drafts, has no effect whenitemsis a single schema:program,info,pointer/template, andprogram/context/gather/pick/variables.Schema example and validity tests pass.