juicewcode commented on PR #7026:
URL: https://github.com/apache/shenyu/pull/7026#issuecomment-6251767391

   @Aias00 Hi! After merging the protocol extraction from #7602, the 
registration DTOs now live in shenyu-register-protocol, which must remain 
JDK-only. Adding Jakarta Validation annotations to these DTOs violates that 
dependency boundary, so I would like to discuss where the HTTP request 
validation should live. 
   
   I see two options: 
   Option 1: An Admin-side Spring Validator. Keep the protocol DTOs free of 
validation annotations, implement the required-field checks in Admin, and 
register the validator through a controller-local @InitBinder. The existing 
@Valid @RequestBody parameters would trigger validation and return HTTP 400 
before publishing invalid registrations. This avoids duplicate DTOs and mapping 
code, but requires maintaining explicit validation rules. 
   
   Option 2: Separate Admin request DTOs with Jakarta Validation annotations. 
Introduce Admin-owned request DTOs containing the validation annotations, 
validate them at the controller boundary, and map them to the protocol DTOs 
before publishing. This keeps annotation-based validation, but duplicates the 
request fields and adds mapping code that must stay aligned with the wire 
models.  Both options keep shenyu-register-protocol JDK-only and can preserve 
the current required-field checks, including nested MCP metadata validation. 
    Would you prefer this approach?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to