-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for discussion in #103
- Loading branch information
Showing
4 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...r-for-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app54/App54.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package de.qaware.openapigeneratorforspring.test.app54; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
class App54 { | ||
public static void main(String[] args) { | ||
SpringApplication.run(App54.class, args); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ng-test/src/test/java/de/qaware/openapigeneratorforspring/test/app54/App54Controller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package de.qaware.openapigeneratorforspring.test.app54; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import lombok.Value; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping | ||
class App54Controller { | ||
@GetMapping("mapping1") | ||
public Animal mapping1() { | ||
return null; | ||
} | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = Dog.class, name = "DOG"), | ||
@JsonSubTypes.Type(value = Cat.class, name = "CAT"), | ||
}) | ||
private interface Animal { | ||
|
||
} | ||
|
||
@Value | ||
private static class Dog { | ||
String wuff; | ||
} | ||
|
||
@Value | ||
private static class Cat { | ||
String meow; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...r-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app54/App54Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package de.qaware.openapigeneratorforspring.test.app54; | ||
|
||
import de.qaware.openapigeneratorforspring.test.AbstractOpenApiGeneratorWebMvcIntTest; | ||
|
||
class App54Test extends AbstractOpenApiGeneratorWebMvcIntTest { | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
openapi-generator-for-spring-test/src/test/resources/openApiJson/app54.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "API for App54", | ||
"version": "unknown" | ||
}, | ||
"paths": { | ||
"/mapping1": { | ||
"get": { | ||
"operationId": "mapping1", | ||
"responses": { | ||
"200": { | ||
"description": "Default response", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"$ref": "#/components/schemas/App54Controller.Animal" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"App54Controller.AnimalType": { | ||
"type": "string", | ||
"enum": [ | ||
"DOG", | ||
"CAT" | ||
] | ||
}, | ||
"App54Controller.Dog": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"$ref": "#/components/schemas/App54Controller.AnimalType" | ||
}, | ||
"wuff": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"App54Controller.Cat": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"$ref": "#/components/schemas/App54Controller.AnimalType" | ||
}, | ||
"meow": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"App54Controller.Animal": { | ||
"discriminator": { | ||
"propertyName": "type", | ||
"mapping": { | ||
"DOG": "#/components/schemas/App54Controller.Dog", | ||
"CAT": "#/components/schemas/App54Controller.Cat" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/App54Controller.Dog" | ||
}, | ||
{ | ||
"$ref": "#/components/schemas/App54Controller.Cat" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |