Skip to content

Commit 656c268

Browse files
committed
add end-to-end test (#176)
1 parent fcc2e7d commit 656c268

File tree

9 files changed

+106
-0
lines changed

9 files changed

+106
-0
lines changed

openapi-processor-core/src/testInt/kotlin/io/openapiprocessor/core/CompileExpectedSpec.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class CompileExpectedSpec: StringSpec({
6262
}
6363
compilePaths.add(Path.of("src/testInt/resources/compile/Mapping.java"))
6464
compilePaths.add(Path.of("src/testInt/resources/compile/Parameter.java"))
65+
compilePaths.add(Path.of("src/testInt/resources/compile/Prefix.java"))
6566
compilePaths.add(Path.of("src/testInt/resources/compile/jakarta/Constraint.java"))
6667
compilePaths.add(Path.of("src/testInt/resources/compile/jakarta/ConstraintValidator.java"))
6768
compilePaths.add(Path.of("src/testInt/resources/compile/jakarta/ConstraintValidatorContext.java"))

openapi-processor-core/src/testInt/kotlin/io/openapiprocessor/core/ProcessorTestSets.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ val ALL_30: List<TestParams> = listOf(
7979
test30_DR("schema-composed-allof-ref-sibling"),
8080
test30_DR("schema-composed-nested"),
8181
test30_DR("schema-composed-oneof-interface"),
82+
//test30_DR("schema-duplicate-by-refs"), // not supported
83+
test30_DR("server-url"),
8284
test30_DR("swagger-parsing-error")
8385
)
8486

@@ -154,5 +156,7 @@ val ALL_31: List<TestParams> = listOf(
154156
test31_DR("schema-composed-allof-ref-sibling"),
155157
test31_DR("schema-composed-nested"),
156158
test31_DR("schema-composed-oneof-interface"),
159+
//test31_DR("schema-duplicate-by-refs"), // not supported
160+
test31_DR("server-url"),
157161
test31_DR("swagger-parsing-error")
158162
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package annotation;
2+
3+
import java.lang.annotation.Documented;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.Target;
6+
7+
import static java.lang.annotation.ElementType.TYPE;
8+
import static java.lang.annotation.RetentionPolicy.CLASS;
9+
10+
@Documented
11+
@Retention(CLASS)
12+
@Target({TYPE})
13+
public @interface Prefix {
14+
String value();
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
items:
2+
- inputs/openapi30.yaml
3+
- inputs/openapi31.yaml
4+
- inputs/mapping.yaml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
openapi-processor-mapping: v9
2+
3+
options:
4+
package-name: generated
5+
server-url: 0
6+
format-code: false
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
openapi: 3.0.2
2+
info:
3+
title: test template
4+
version: 1.0.0
5+
6+
servers:
7+
- url: "{schema}://{host}:{port}/{path1}/{path2}/v{version}"
8+
variables:
9+
schema:
10+
default: https
11+
enum:
12+
- https
13+
- http
14+
host:
15+
default: openapiprocessor.io
16+
port:
17+
default: "443"
18+
path1:
19+
default: foo
20+
path2:
21+
default: bar
22+
version:
23+
default: "1"
24+
25+
paths:
26+
/foo:
27+
get:
28+
responses:
29+
'204':
30+
description: ...
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
openapi: 3.1.0
2+
info:
3+
title: test template
4+
version: 1.0.0
5+
6+
servers:
7+
- url: "{schema}://{host}:{port}/{path1}/{path2}/v{version}"
8+
variables:
9+
schema:
10+
default: https
11+
enum:
12+
- https
13+
- http
14+
host:
15+
default: openapiprocessor.io
16+
port:
17+
default: "443"
18+
path1:
19+
default: foo
20+
path2:
21+
default: bar
22+
version:
23+
default: "1"
24+
25+
paths:
26+
/foo:
27+
get:
28+
responses:
29+
'204':
30+
description: ...
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
items:
2+
- outputs/api/Api.java
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package generated.api;
2+
3+
import annotation.Mapping;
4+
import annotation.Prefix;
5+
import generated.support.Generated;
6+
7+
@Generated(value = "openapi-processor-core", version = "test")
8+
@Prefix("/foo/bar/v1")
9+
public interface Api {
10+
11+
@Mapping("/foo")
12+
void getFoo();
13+
14+
}

0 commit comments

Comments
 (0)