cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply one-side range validation in CAP?

epamtiosteel
Explorer
0 Kudos

Hi colleagues,

Is there any way in CAP to validate a value agains some range with only one side restricted by just annotations?

unfortunately @assert.range has only 2-sides restriction as per documentation

https://cap.cloud.sap/docs/guides/providing-services#assert-range

The most common case is when I want to restrict my number with non-negative (>= 0) or positive (> 0) value.

Thank you.

View Entire Topic
Dinu
Contributor

You can give the open range as the maximum/minimum for the data type.

epamtiosteel
Explorer
0 Kudos

Hi dinu.pavithran,

thank you, looks like a rough but viable way to go.

Should I refer to https://help.sap.com/docs/HANA_SERVICE_CF/7c78579ce9b14a669c1f3295b0d8ca16/20a1569875191014b507cf392...

https://help.sap.com/docs/HANA_SERVICE_CF/7c78579ce9b14a669c1f3295b0d8ca16/4ee2f261e9c44003807d08ccc...

?

or some different page? my concern is I can't really see the max value for decimals.