Skip to content

Commit 3426164

Browse files
committed
add integration test (#92)
1 parent 4d9c872 commit 3426164

13 files changed

Lines changed: 180 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class CompileExpectedSpec: StringSpec({
7070
compilePaths.add(Path.of("src/testInt/resources/compile/jakarta/Size.java"))
7171
compilePaths.add(Path.of("src/testInt/resources/compile/jakarta/Valid.java"))
7272
compilePaths.add(Path.of("src/testInt/resources/compile/javax/Valid.java"))
73+
compilePaths.add(Path.of("src/testInt/resources/compile/oap/FooA.java"))
74+
compilePaths.add(Path.of("src/testInt/resources/compile/oap/FooB.java"))
75+
compilePaths.add(Path.of("src/testInt/resources/compile/oap/FooC.java"))
7376

7477
val expected = support.readTestItems(sourcePath, "outputs.yaml").items
7578
val expectedFileNames = expected.map { it.replaceFirst("<model>", "model/${testSet.modelType}") }

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ val ALL_30: List<TestParams> = listOf(
1717
test30_D_("bean-validation-requestbody"),
1818
test30_D_("bean-validation-requestbody-mapping"),
1919
test30_DR("components-requestbodies"),
20+
test30_DR("extension-mapping"),
2021
test30_DR("deprecated"),
2122
test30_D_("endpoint-exclude"),
2223
test30_D_("endpoint-http-mapping"), // framework specific
@@ -86,6 +87,7 @@ val ALL_31: List<TestParams> = listOf(
8687
test31_D_("bean-validation-requestbody"),
8788
test31_D_("bean-validation-requestbody-mapping"),
8889
test31_DR("components-requestbodies"),
90+
test31_DR("extension-mapping"),
8991
test31_DR("deprecated"),
9092
test31_D_("endpoint-exclude"),
9193
test31_D_("endpoint-http-mapping"), // framework specific
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.oap;
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.FIELD;
8+
import static java.lang.annotation.RetentionPolicy.CLASS;
9+
10+
@Documented
11+
@Retention(CLASS)
12+
@Target({FIELD})
13+
public @interface FooA {
14+
String value();
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.oap;
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.FIELD;
8+
import static java.lang.annotation.RetentionPolicy.CLASS;
9+
10+
@Documented
11+
@Retention(CLASS)
12+
@Target({FIELD})
13+
public @interface FooB {
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.oap;
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.FIELD;
8+
import static java.lang.annotation.RetentionPolicy.CLASS;
9+
10+
@Documented
11+
@Retention(CLASS)
12+
@Target({FIELD})
13+
public @interface FooC {
14+
}
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
openapi-processor-mapping: v6
2+
3+
options:
4+
package-name: generated
5+
format-code: false
6+
7+
map:
8+
extensions:
9+
x-foo: single @ io.oap.FooA(value = "any")
10+
x-bar:
11+
- listA @ io.oap.FooB
12+
- listB @ io.oap.FooC
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.0.2
2+
info:
3+
title: test extension mapping
4+
version: 1.0.0
5+
6+
paths:
7+
8+
/foo:
9+
get:
10+
responses:
11+
'200':
12+
description: the foo result
13+
content:
14+
application/json:
15+
schema:
16+
$ref: '#/components/schemas/Foo'
17+
18+
components:
19+
schemas:
20+
21+
Foo:
22+
type: object
23+
properties:
24+
bar:
25+
type: string
26+
x-foo: single
27+
x-bar:
28+
- listA
29+
- listB
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.1.0
2+
info:
3+
title: test extension mapping
4+
version: 1.0.0
5+
6+
paths:
7+
8+
/foo:
9+
get:
10+
responses:
11+
'200':
12+
description: the foo result
13+
content:
14+
application/json:
15+
schema:
16+
$ref: '#/components/schemas/Foo'
17+
18+
components:
19+
schemas:
20+
21+
Foo:
22+
type: object
23+
properties:
24+
bar:
25+
type: string
26+
x-foo: single
27+
x-bar:
28+
- listA
29+
- listB
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
items:
2+
- outputs/api/Api.java
3+
- outputs/<model>/Foo.java

0 commit comments

Comments
 (0)