Skip to content

UNOMI-934/935: Return 400 for invalid rule/segment create (Phase 2 PR 4)#787

Merged
sergehuber merged 2 commits into
masterfrom
UNOMI-934-rest-create-validation
Jun 29, 2026
Merged

UNOMI-934/935: Return 400 for invalid rule/segment create (Phase 2 PR 4)#787
sergehuber merged 2 commits into
masterfrom
UNOMI-934-rest-create-validation

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Summary

Context (Phase 2 backport audit)

  • §2 audit: No diff on RulesServiceEndPoint / SegmentServiceEndPoint vs unomi-3-dev — service-layer validation already exists on master; this PR is FRESH REST error-mapping only.
  • Stack: Builds on merged UNOMI-884: Platform polish audit (Phase 2 PR 3) #786 (df5f313de). No endpoint or validation logic changes.

Test plan

  • mvn -pl rest test -Dtest=RestExceptionMapperTest (11 tests pass)
  • POST invalid rule condition → 400 badRequest (not 500)
  • POST invalid segment condition → 400 badRequest (not 500)

…ase 2 PR 4)

Extend master’s AbstractRestExceptionMapper pattern so IllegalArgumentException and BadSegmentConditionException from POST /cxs/rules and /cxs/segments return 400 badRequest instead of 500. Service-layer validation is unchanged; adds dedicated mappers, RuntimeExceptionMapper fallback for wrapped causes, and unit tests.
…ceptionMapper to 400

Extend the existing wrapped-cause handling so IllegalArgumentException and BadSegmentConditionException surfaced via InternalServerErrorException also return badRequest, matching RuntimeExceptionMapper behavior.
@sergehuber sergehuber merged commit 3c6f936 into master Jun 29, 2026
2 of 3 checks passed
@sergehuber sergehuber deleted the UNOMI-934-rest-create-validation branch June 29, 2026 09:52
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