#Validate request param is equal to value otherwise BadRequest

10 messages · Page 1 of 1 (latest)

deep coyote
#

Hello how can I validate a request param so that it must be a concrete value?

sonic beaconBOT
#

This post has been reserved for your question.

Hey @deep coyote! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

deep coyote
#

By using @Value annotation on top of the attribute like so:


@Valid
@Value("value")
private String myAtrib;
#

This would work? What if I wanna admit two possible values?

#

@Valid
@Value("value", "value2")
private String myAtribTwoVals;
deep coyote
#

Maybe I should use a custom validator that fulfills my expectations.

#

🤣

spark ginkgo
#

yeah, this should be a custom validator

deep coyote