-
Notifications
You must be signed in to change notification settings - Fork 433
/
constraints-person.xml
51 lines (41 loc) · 1.79 KB
/
constraints-person.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<constraint-mappings
xmlns="http://xmlns.jcp.org/xml/ns/validation/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/validation/mapping
http://xmlns.jcp.org/xml/ns/validation/mapping/validation-mapping-2.0.xsd"
version="2.0">
<bean class="io.grpc.examples.GreeterOuterClass$Person">
<class>
<constraint annotation="org.lognet.springboot.grpc.demo.PersonConstraint"/>
</class>
<getter name="name">
<constraint annotation="jakarta.validation.constraints.NotEmpty"/>
</getter>
<getter name="nickName">
<!--should be empty for request message-->
<constraint annotation="jakarta.validation.constraints.Size">
<groups>
<value>org.lognet.springboot.grpc.validation.group.RequestMessage</value>
</groups>
<element name="min">0</element>
<element name="max">0</element>
</constraint>
<!--should NOT be empty for response message-->
<constraint annotation="jakarta.validation.constraints.NotEmpty">
<groups>
<value>org.lognet.springboot.grpc.validation.group.ResponseMessage</value>
</groups>
</constraint>
</getter>
<getter name="age">
<constraint annotation="jakarta.validation.constraints.Max">
<element name="value">120</element>
</constraint>
</getter>
<method name="hasAddress">
<return-value>
<constraint annotation="jakarta.validation.constraints.AssertTrue"/>
</return-value>
</method>
</bean>
</constraint-mappings>