Skip to content

Commit 3fa8192

Browse files
committed
add test case (#290)
1 parent 6450c24 commit 3fa8192

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
prefix: api
2+
items:
3+
- inputs/openapi30.yaml
4+
- inputs/openapi31.yaml
5+
- inputs/mapping.yaml
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
openapi-processor-mapping: v13
2+
3+
options:
4+
package-name: generated
5+
bean-validation: jakarta
6+
format-code: false
7+
8+
map:
9+
types:
10+
- type: integer:year => java.time.Year
11+
12+
13+
#bean-validation:
14+
# javax.validation.constraints.DecimalMin:
15+
# - java.lang.BigDecimal
16+
# - java.lang.BigInteger
17+
# - java.lang.CharSequence
18+
# - java.lang.Byte
19+
# - java.lang.Short
20+
# - java.lang.Integer
21+
# - java.lang.Long
22+
# - byte
23+
# - short
24+
# - int
25+
# - long
26+
# - some.Class
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
openapi: 3.0.2
2+
info:
3+
title: drop bean validation annotation if mapped to unsupported type
4+
version: 1.0.0
5+
6+
paths:
7+
8+
/foo:
9+
get:
10+
parameters:
11+
# the parameter is mapped from `integer` to `Year`. The bean validation annotations `@DecimalMin(value = "1970")`
12+
# and `@DecimalMax(value = "2099")` added by `minimum` and `maximum` are not supported on `Year` and should be
13+
# removed.
14+
- in: query
15+
name: year
16+
schema:
17+
type: integer
18+
format: year
19+
minimum: 1970
20+
maximum: 2099
21+
responses:
22+
'204':
23+
description: empty
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
openapi: 3.1.0
2+
info:
3+
title: drop bean validation annotation if mapped to unsupported type
4+
version: 1.0.0
5+
6+
paths:
7+
8+
/foo:
9+
get:
10+
parameters:
11+
# the parameter is mapped from `integer` to `Year`. The bean validation annotations `@DecimalMin(value = "1970")`
12+
# and `@DecimalMax(value = "2099")` added by `minimum` and `maximum` are not supported on `Year` and should be
13+
# removed.
14+
- in: query
15+
name: year
16+
schema:
17+
type: integer
18+
format: year
19+
minimum: 1970
20+
maximum: 2099
21+
responses:
22+
'204':
23+
description: empty
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
prefix: generated
2+
items:
3+
- outputs/api/Api.java
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package generated.api;
2+
3+
import annotation.Mapping;
4+
import annotation.Parameter;
5+
import annotation.Status;
6+
import generated.support.Generated;
7+
import java.time.Year;
8+
9+
@Generated(value = "openapi-processor-core", version = "test")
10+
public interface Api {
11+
12+
@Status("204")
13+
@Mapping("/foo")
14+
void getFoo(@Parameter Year year);
15+
16+
}

0 commit comments

Comments
 (0)