feat: wire constraint generation on form save and validate on subscri…#15918
feat: wire constraint generation on form save and validate on subscri…#15918JedrzejJanasiak merged 1 commit intomasterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request, the third in a series, introduces crucial functionality for managing and validating subscription form metadata. It ensures that whenever a subscription form is updated, its validation rules are automatically derived from the Gravitee Markdown definition and stored. Subsequently, any new subscription requests are rigorously checked against these defined rules, preventing invalid metadata submissions and improving data integrity. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively wires up constraint generation for subscription forms on save and adds validation for subscription metadata against these constraints. The changes in UpdateSubscriptionFormUseCase to generate constraints from GMD and in SubscriptionValidationServiceImpl to perform the validation are clear and well-implemented. The simplification of SubscriptionForm.update is a good improvement for code clarity. The accompanying tests are comprehensive, covering various scenarios including edge cases for both the use case and the validation service, and ensuring correct exception handling at the resource layer. The implementation aligns perfectly with the description, and I found no issues with the changes.
1ab6a9f to
64897da
Compare
80333cf to
699c2e2
Compare
64897da to
b837a70
Compare
699c2e2 to
4ccfcdc
Compare
c460e7a to
aa83d72
Compare
4ccfcdc to
cf90c39
Compare
c954f07 to
358a877
Compare
cf90c39 to
2048132
Compare
358a877 to
d61efd4
Compare
f075333 to
8063362
Compare
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
.../java/io/gravitee/rest/api/service/v4/impl/validation/SubscriptionValidationServiceImpl.java
Outdated
Show resolved
Hide resolved
8063362 to
8b03cb6
Compare
|



Issue
https://gravitee.atlassian.net/browse/APIM-12990
Description
PR 3/3 — Resource layer: constraint generation on form save + submission validation.
Previous: #15864 (PR 2/3 — repository layer, constraint persistence)
This PR adds:
UpdateSubscriptionFormUseCasenow generates constraints from GMD on every save(
GMD → schemaGenerator.generate() → ConstraintsFactory.fromSchema() → persist)SubscriptionForm.update()simplified — always replaces constraints, null-as-skip removedSubscriptionValidationServiceImplvalidates submitted metadata against stored constraintsat subscription creation time (only when form exists, is enabled, and has non-empty constraints)
UpdateSubscriptionFormUseCase(constraint generation scenarios)SubscriptionValidationServiceImpl(all guard conditions: form absent, disabled,empty constraints, null metadata, valid/invalid submission)
SubscriptionFormValidationException→ HTTP 400Not in this PR (coming in following story):
Additional context
The validator is intentionally "dumb" — it only validates metadata keys that have constraints
defined in the form. Metadata from other sources is passed through without validation.