Skip to content

Conversation

@SentryMan
Copy link
Collaborator

Resolves #669 by adding a default handler via the inject plugin

@SentryMan SentryMan added this to the 3.6 milestone Nov 20, 2025
@SentryMan SentryMan self-assigned this Nov 20, 2025
@SentryMan SentryMan added the enhancement New feature or request label Nov 20, 2025
@SentryMan SentryMan enabled auto-merge (squash) November 20, 2025 05:14
@SentryMan
Copy link
Collaborator Author

@mechite how's this?

Copy link
Contributor

@mechite mechite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SentryMan hard to review on a phone 🤣 I like it

@SentryMan SentryMan requested a review from rbygrave November 20, 2025 15:12
@mechite
Copy link
Contributor

mechite commented Nov 20, 2025

@SentryMan I'm reviewing here now on a computer.

  1. RFC 9457 says that we should use application/problem+json or application/problem+xml` MIME types when using these standard error responses

  2. It also states:

    The type URI is allowed to be a non-resolvable URI

    therefore, we actually don't need to point to the Avaje website.

We can do something like: tag:io.avaje.validator.constraints.Size#min, using the tag: URI scheme (not 100% sure how it's meant to be used).
But we can also just find a fluent way of excluding the "avaje" name from the response.

@SentryMan I see JSON Schema for HTTP Problems which is a specification for how the responses are meant to look.
Unfortunately, this schema is not published anywhere (for example the parent JSON Schema is published here].

While the following doesn't exclude the "avaje" name from the response, it does make it more abstract:

If we upload this schema to avaje.io/rfc9457.json, and put that into the response "type":, we get something that "has nothing to do with" / "is abstract to" the use of avaje, but is just a JSON description of what the response is meant to look like.

@SentryMan
Copy link
Collaborator Author

We can do something like: tag:io.avaje.validator.constraints.Size#min, using the tag: URI scheme (not 100% sure how it's meant to be used).

idk what to make of this statement

@mechite
Copy link
Contributor

mechite commented Nov 20, 2025

"your data failed the vibe check"

this guy

idk what to make of this statement

I mean that we basically can just point to a class file in Avaje, instead of a web URL

Ideally to me, this JSON schema I said that the RFC contains, could have been uploaded to e.g. ietf.org,
so our APIs written using avaje aren't now announcing to everyone who sends a bad request that
we are using avaje...
It's not a big deal or issue at all.

If we upload this schema to avaje.io/rfc9457.json

This suggestion was to say that we upload the official JSON schema, which is probably more useful
than pointing to the documentation of validator

@mechite
Copy link
Contributor

mechite commented Nov 20, 2025

d55a7a6 - OK, but we better verify that this is indeed valid for the tag: URI

@mechite
Copy link
Contributor

mechite commented Nov 21, 2025

a9d93ff

// Custom serialize so we don't need any json lib

Would this really be worth it over adding json-core or even full jsonb - since they have streaming writers?
Those libraries are so small and most people would have them anyway

@SentryMan
Copy link
Collaborator Author

Would this really be worth it over adding json-core or even full jsonb - since they have streaming writers? Those libraries are so small and most people would have them anyway

nahhh it's probably fine

@SentryMan SentryMan marked this pull request as draft November 21, 2025 03:54
auto-merge was automatically disabled November 21, 2025 03:54

Pull request was converted to draft

@mechite
Copy link
Contributor

mechite commented Nov 21, 2025

🤣 he says it's fine, then optimizes anyway

@SentryMan SentryMan marked this pull request as ready for review November 21, 2025 05:13
@SentryMan SentryMan enabled auto-merge (squash) November 21, 2025 05:13
Removed unused getter methods from ValidationResponse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enhancement] Default middleware for handling validation exceptions

2 participants