Skip to content

perf: Avoid throwing ValidationExceptions in happy flow#50

Merged
thced merged 2 commits into
masterfrom
fix/performance
May 12, 2026
Merged

perf: Avoid throwing ValidationExceptions in happy flow#50
thced merged 2 commits into
masterfrom
fix/performance

Conversation

@thced

@thced thced commented May 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

thced added 2 commits May 12, 2026 10:57
Tests added in the JSON Schema type-coercion fix used the pre-extensions
record signatures and stopped compiling after the OpenAPI extensions
feature merged into master.
…Optional returns

JFR profiling under load showed ~267 ValidationException throws/sec on
the happy path — oneOf/anyOf branch selection was catching exceptions
to determine which branch matched, paying allocation + stack-walk cost
for every non-matching branch even when the request ultimately succeeded.

Internal validation now returns Optional<ValidationError> and branch
selection inspects the result. ValidationException is constructed at
most once per request, only at the public validate() boundary when
real validation has failed. A static counter on ValidationException
makes the contract observable and testable.
@thced thced merged commit f646566 into master May 12, 2026
3 checks passed
@thced thced deleted the fix/performance branch May 12, 2026 11:49
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