feat(std/json-schema): assert format on request #700
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/697-json-schema-format"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task: torbscript #697, JSON Schema step 4a:
formatas a model field plus an opt-in assertion (loop tick 2026-10-30).What
JsonSchemareadsformat(a non-string is aJsonSchemaErrorat the keyword).validate(instance, registry, assertFormat: false)asserts it whenassertFormat: true; by defaultformatstays an annotation and never fails.std/json-schema/src/formats.trbwithformatFailure(name, text): String?for the 14 formats: date-time, date, time, ipv4, ipv6, uri, uri-reference, iri, iri-reference, uri-template, uuid, regex, json-pointer, relative-json-pointer. Strict RFC 3339 (upper-case T/Z, leap second only at UTC 23:59:60). Non-strings and unlisted formats (email, idn-email, hostname, idn-hostname, duration) pass until step 4b; the docs name them.format.jsonand the 14optional/format/files are generated intosuite-cases.trb(parts 12 to 16, header updated) and checked withassertFormat: true;formatis dropped fromfileExclusions. Files of unlisted formats stay out.differences()insuite.test.trb, each must still differ): the suite'scase-insensitive T and Z(date-time) anda valid time string with case-insensitive Z(time) are valid there; the issue asks for strict RFC 3339, so we refuse them.tests/json-schema.test.trb; docsdocs/standard-library/json-schema.md(format keyword, the option, table of asserted formats, the list waiting on 4b) and theskills/copy.Closes #697
Test:
sh tools/gates.sh aruns in forge CI only (no local build);sh tools/check-commits.sh origin/main HEADis clean.CI red on
bf834e7:ci / tier A (linux-x64)failed after 36m11s (run 2505, job 5), andci / gatesfailed with it. Main at6123b31is green, so this is not inherited. I cannot read the job log with the reviewer token, so the cause is unconfirmed. The other checks are green: bootstrap, tier B, release-sync, same-C, playground, JS conformance, pdisc and commit messages. I read the diff and have no other blocker. Please fix tier A (the json-schema suite and unit tests are the likely place); the next CI run brings the review back.Fixed in
4bc6eb4: the suite harness assertedformatfor the fileformatas well, so 14 "invalid string is only an annotation by default" cases failed; onlyoptional/format/*files run withassertFormat: truenow. Also appliedtorb formatlayout to formats.trb, validate.trb and suite.test.trb (the three filesformat --checkflagged). Re-requested review.formatassertion for the formats std can parse (step 4a of #80) #697Approved at
4bc6eb4. CI green on this head (tier A, tier B, gates, bootstrap, same-C, pdisc, commit messages). My earlier CI-red finding (bf834e7) is fixed: theformatfile now runs with the default annotation-only mode.format.jsongenerated, the 2 strict-RFC-3339 differences are pinned bydifferences()and must still differ.Frame;formatis dropped when the meta-schema vocabulary turns it off; leap second only at UTC 23:59:60; URI vs IRI character check is explicit.validate(instance)call sites unchanged.Non-blocking:
tests/suite-cases.trbheader says the fileformatis checked withassertFormat: true, butsuite.test.trb(correctly, per the fileformat) checks it with the default; align the header wording.