feat: read the format keyword as part of the type - #225
Merged
alexander-akait merged 1 commit intoSep 8, 2026
Conversation
A `format` was reported as a hint next to the constraints of the string:
configuration.strictFormat should be a string (should match format "date", should be < "2016-02-06").
It names the string, so it now reads as part of the type:
configuration.strictFormat should be a date string (should be < "2016-02-06").
The name is turned into words, so a `date-time`, a `snake_case` and a
`camelCase` format all read as words. A format is any string though, not only
a name - one that is not a name, such as the pattern `[0-9]*`, is still
reported as a hint, and so is a negated format, which no type can state.
Taken from #68, without the part of it moving `absolutePath` from a keyword
to a format, which is breaking and was left open for discussion there.
Co-Authored-By: Ivan Kopeykin <10380560+vankop@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
This was referenced Sep 8, 2026
Closed
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #225 +/- ##
==========================================
+ Coverage 96.66% 96.72% +0.06%
==========================================
Files 9 10 +1
Lines 989 1009 +20
Branches 408 414 +6
==========================================
+ Hits 956 976 +20
Misses 31 31
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexander-akait
deleted the
claude/filter-errors-quadratic-sibling-dos-1tqe2l
branch
September 8, 2026 16:01
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.
Salvages what is still useful from #59 and #68, both of which this supersedes.
What is left in those two
#59 (
feat: format object properties with types, issue #42) — the feature it adds landed in #224, so nothing here comes from it. Worth recording why it is not just rebased: it names the property type from a bareschema.properties[x].type, which printsfoo: string,numberfor a union and nothing at all for a property described byanyOf/$ref/const. #224 formats the type throughformatInnerSchemaand drops it when it is composite or when the shape stops fitting on a line. The two open questions in its thread stay open — breaking long objects over lines (also raised in #42 (comment)) and sorting properties alphabetically.#68 (
feat: humanize format, issue #66) — two separate things. TheabsolutePath-as-a-format half is breaking and vankop flagged it for discussion; #223 has since covered that reporting as a keyword, so it is dropped. The other half is not onmainand is what this PR takes.The change
A
formatwas reported as a hint sitting next to the constraints of the string:It names the string, so it now reads as part of the type:
src/util/humanize.jsturns the name into words, sodate-time,snake_case,PascalCaseandcamelCaseformats all read as words.Two cases #68 did not cover, both of which the existing fixtures caught:
format: "[0-9]*", which humanizing renders as[0 9]* string. A format that is not a name is left as a hint.should not match format "date"stays a hint.The format name goes next to the word it names rather than in front of the whole type, so a
format: "email"withminLength: 1isa non-empty email string, notan email non-empty string.Tests
test/humanize.test.jscarries over vankop's word list from #68, plus the empty/one-character anddate-timecases.test/hints.test.jsgains the composition and negation cases; its existing[0-9]*case covers the not-a-name guard. Two snapshots move, both to the shorter message above.npm test(503 tests, 338 snapshots),npm run lintandnpm run buildall pass.Co-authored with @vankop, whose commit in #68 this is taken from.
🤖 Generated with Claude Code
https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Generated by Claude Code