Repository navigation
v0.5.0: full schema validation, richer annotations and schema_for - #6
Merged
Merged
Conversation
Validator - Enforce enum, length, pattern, numeric bounds, array size/uniqueness, additionalProperties and oneOf/anyOf/allOf; report every error with a JSON Pointer - Only parse JSON media types, return 415 for non-JSON Content-Type and 413 above Kemal's max_request_body_size - Validate annotated routes even when setup is never called Annotations and spec - Support parameters, security, "default"/range responses and schema expressions in request_body - Document undocumented path parameters (:id, *glob) automatically - Accept route blocks with any argument name schema_for - Make it a generic method so it works at the top level - Map Int64/UInt/Float32, Time, UUID, enums, typed collections, nested serializable types, unions and JSON::Any; fields with defaults are optional Also: refresh the spec cache on registration, pin ReDoc, serve docs only on GET/HEAD, add CI, CHANGELOG and README updates. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Aj3mC5LttRzqomzHWPj4M
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Aj3mC5LttRzqomzHWPj4M
erayjsx
marked this pull request as ready for review
October 14, 2026 17:14
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Aj3mC5LttRzqomzHWPj4M
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.
Requested by Eray · project thread
Before: request validation only checked types and required fields. Constraints like
enum,minLength,patternoroneOfwere documented but never enforced. Multipart routes got a 400 on every request.parametersandsecurityin@[OpenAPI]were silently dropped.schema_for(User)did not compile at the top level, even though that is how the README showed it.After: JSON bodies are validated against the full schema, and every error is reported with a JSON Pointer. Non-JSON bodies pass through untouched. Oversized bodies get 413 and a wrong
Content-Typegets 415. The annotation supportsparameters,security,"default"responses and schema expressions. Path parameters are documented automatically, andschema_formaps real Crystal types, including nested types, enums, collections and unions.How
validator.cris rewritten arounderrors_for(json, schema), which collectsValidationError(pointer, message)values. The response body keepserrorandmessage(the first error) and adds anerrorsarray.Schema#typeis now nilable with aneffective_type. PureoneOf/anyOf/allOf,$refandenumschemas no longer default toobject, and existing schemas still emit"type": "object". New keywords:exclusiveMinimum/exclusiveMaximum,multipleOf,minItems/maxItems/uniqueItems,readOnly/writeOnly,title,deprecated.schema_foris now a generic method (forall T), becauseinstance_varsis not available at the top level. Nested types are inlined up tomax_depth(4 by default), so recursive types are safe.register*, ReDoc is pinned to 2.5.4, the docs handler only answers GET/HEAD, and the UI title followssetup(title:).Breaking changes for 0.x:
Schema#typeandResponse#status_codeare now nilable.The second commit is
crystal tool formatonly. Run locally: 84 specs pass on Crystal 1.19.1 and 1.22.0 with Kemal 1.14.0, andexample/app.crplus the README snippets compile.🤖 Generated with Claude Code
https://claude.ai/code/session_018Aj3mC5LttRzqomzHWPj4M
Generated by Claude Code