Skip to content

errors/1 problems helper - #93

Merged
JosteinGj merged 1 commit into
mainfrom
errors/1-problems-helper
Sep 16, 2026
Merged

JosteinGj merged 1 commit into
mainfrom
errors/1-problems-helper

Conversation

@JosteinGj

Copy link
Copy Markdown
Contributor

What this changes

How it was verified

Checklist

  • Pull requests this one depends on are named above and merged first, or there are none
  • Commits are signed off (git commit -s), per CONTRIBUTING.md
  • ./gradlew build passes
  • Behaviour visible outside this repo is reflected in the documentation, or does not need to be
    (see AGENTS.md for which of the two documentation sites it belongs in)

@JosteinGj
JosteinGj added this pull request to stack #99 September 15, 2026 09:17
@olavgg
olavgg force-pushed the errors/1-problems-helper branch from e361530 to e27d577 Compare September 15, 2026 13:26
Adds Problems, the conventions for RFC 9457 problem responses. Nothing uses it
yet; the advices and controllers follow.

Errors were rendered four ways: ten advices returned ProblemDetail, two returned
a ResponseError<T> wrapper, controllers hand-rolled bare strings in 27 places,
and BuildErrorResponse returned a DataWrapper — a success-shaped envelope, so a
validation failure came back as {"items":[{"externalId":"must not be blank"}]}
and a client could not tell it from a successful listing by shape.

Three things the class settles:

type is the contract, and there is one host. Prose changes, a URI does not.
UserInfoRejectedExceptionHandler currently mints datahub.intellistream.ai while
everything else uses intellistream.ai — a second host for one scheme, which is
what declaring the types as constants is meant to stop.

fields keeps what the old shape threw away. FieldValidationError carries an
i18n key and its arguments — resource.source.max.length.error with the offending
length — and BuildErrorResponse collapsed each into Map.of(path, message),
dropping both. Callers got English prose they could neither localise nor read
the limit from. The extension carries all four parts, so the response is more
useful than the one it replaces.

Extensions are RFC 9457's own mechanism (§3.2) and consumers must ignore
unrecognised ones, so adding a member later cannot break a conforming client —
unlike adding a field to a bespoke wrapper a strict deserializer may reject.

ProblemWireShapeTest renders one through MVC rather than a plain mapper: the
mixin that flattens extensions to the top level is applied by the message
converter, not the type, so a unit test alone would have suggested callers
should read $.properties.fields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
@JosteinGj
JosteinGj force-pushed the errors/1-problems-helper branch from e27d577 to 652d3ee Compare September 16, 2026 07:40
@JosteinGj
JosteinGj marked this pull request as ready for review September 16, 2026 07:40
@JosteinGj
JosteinGj requested a review from olavgg as a code owner September 16, 2026 07:40
@JosteinGj
JosteinGj merged commit eaea355 into main Sep 16, 2026
9 checks passed
@JosteinGj
JosteinGj deleted the errors/1-problems-helper branch September 16, 2026 07:50
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.

2 participants