Skip to content

feat: Implement JSON Schema boolean schemas (true/false)#43

Merged
thced merged 8 commits into
masterfrom
feat/schema-booleans
May 8, 2026
Merged

feat: Implement JSON Schema boolean schemas (true/false)#43
thced merged 8 commits into
masterfrom
feat/schema-booleans

Conversation

@thced

@thced thced commented May 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

thced and others added 8 commits May 8, 2026 16:12
Covers the remaining piece of Wave 1 #4: bare true / false as a
schema. Adds AlwaysSchema and NeverSchema records, changes the parser
entry to accept Object, and wires two validator branches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three-task plan: schema records + parser change, validator branches,
integration test. Mirrors the schema-booleans design spec.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JSON Schema 2020-12 allows a bare true or false where a schema is
expected: true accepts any value, false rejects every value. Add the
two new sealed-hierarchy records and change SchemaParser.parse to
accept Object so boolean values dispatch to the new records. Recursive
callers (parseObject, parseArray, parseList, NotSchema) and external
callers in Spec.java drop their Map casts. AdditionalProperties keeps
its existing Boolean handling. DefaultValidator gets minimal switch
branches for the two new types.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Align NeverSchema validator stub with the spec: keyword is now "false"
  and the rejected value is passed through via fail() instead of require()
- Drop residual Map cast in parseAdditionalProperties; parse(value) accepts
  Object directly so no unchecked cast is needed
- Static-import assertThatThrownBy in SchemaParserTest for consistency
  with the existing assertThat static import
- Add parsesArrayWithBooleanFalseItems test covering items: false -> NeverSchema
- Add rejectsNullRawSchema test covering null raw input -> IllegalArgumentException

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pins the existing case branches (added in Task 1 to keep the sealed
switch compiling) with seven new unit tests covering pass/reject across
string / integer / object / null inputs for both AlwaysSchema and
NeverSchema.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Pin the exact NeverSchema failure message with isEqualTo instead of contains
- Assert that pointer round-trips into the ValidationError
- Assert the rejected value is captured, closing the Task 1 review's
  require vs fail regression risk

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend the OpenAPI fixture with a /gates endpoint whose request body
uses properties.open: true (any value accepted) and properties.blocked:
false (any presence rejected). Two IT cases verify a body with only
'open' returns 200 and a body containing 'blocked' returns 400 with
keyword "false" in the problem detail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bring all tests in OpenApiServerIT into pure-camelCase form, matching
the project convention applied on feat/combinators. Also flip the
remaining final-verification items in the schema-booleans plan to [x]
now that the branch is verified end to end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thced thced force-pushed the feat/schema-booleans branch from d422309 to e045336 Compare May 8, 2026 14:19
@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@thced thced merged commit 1358915 into master May 8, 2026
4 checks passed
@thced thced deleted the feat/schema-booleans branch May 8, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant