-
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple Superclasses Are Not Mapped To Multiple allOf If Used In Dif…
…ferent Services. Fixes #2601.
- Loading branch information
1 parent
fa35308
commit 8a1e0ad
Showing
5 changed files
with
225 additions
and
6 deletions.
There are no files selected for viewing
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
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
28 changes: 28 additions & 0 deletions
28
...i-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app222/HelloController.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,28 @@ | ||
package test.org.springdoc.api.v30.app222; | ||
|
||
|
||
|
||
import test.org.springdoc.api.v30.app222.SpringDocApp222Test.FirstHierarchyUser; | ||
import test.org.springdoc.api.v30.app222.SpringDocApp222Test.SecondHierarchyUser; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* @author bnasslahsen | ||
*/ | ||
|
||
@RestController | ||
class HelloController { | ||
|
||
@GetMapping("/hello1") | ||
public FirstHierarchyUser getItems1() { | ||
return null; | ||
} | ||
|
||
@GetMapping("/hello2") | ||
public SecondHierarchyUser getItems2() { | ||
return null; | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...arter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app222/SpringDocApp222Test.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,55 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2022 the original author or authors. | ||
* * * * * | ||
* * * * * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * * * * you may not use this file except in compliance with the License. | ||
* * * * * You may obtain a copy of the License at | ||
* * * * * | ||
* * * * * https://www.apache.org/licenses/LICENSE-2.0 | ||
* * * * * | ||
* * * * * Unless required by applicable law or agreed to in writing, software | ||
* * * * * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * * * * See the License for the specific language governing permissions and | ||
* * * * * limitations under the License. | ||
* * * * | ||
* * * | ||
* * | ||
* | ||
*/ | ||
|
||
package test.org.springdoc.api.v30.app222; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; | ||
import test.org.springdoc.api.v30.AbstractSpringDocV30Test; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
public class SpringDocApp222Test extends AbstractSpringDocV30Test { | ||
|
||
@SpringBootApplication | ||
static class SpringDocTestApp {} | ||
|
||
@JsonTypeInfo(use = Id.NAME, property = "@type") | ||
@JsonSubTypes(@Type(CommonImplementor.class)) | ||
interface FirstHierarchy {} | ||
|
||
@JsonTypeInfo(use = Id.NAME, property = "@type") | ||
@JsonSubTypes(@Type(CommonImplementor.class)) | ||
interface SecondHierarchy {} | ||
|
||
class CommonImplementor implements FirstHierarchy, SecondHierarchy {} | ||
|
||
record CommonImplementorUser(FirstHierarchy firstHierarchy, SecondHierarchy secondHierarchy) {} | ||
|
||
record FirstHierarchyUser(FirstHierarchy firstHierarchy) {} | ||
|
||
record SecondHierarchyUser(SecondHierarchy secondHierarchy) {} | ||
} |
122 changes: 122 additions & 0 deletions
122
springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app222.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,122 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/hello2": { | ||
"get": { | ||
"tags": [ | ||
"hello-controller" | ||
], | ||
"operationId": "getItems2", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"$ref": "#/components/schemas/SecondHierarchyUser" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/hello1": { | ||
"get": { | ||
"tags": [ | ||
"hello-controller" | ||
], | ||
"operationId": "getItems1", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"$ref": "#/components/schemas/FirstHierarchyUser" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"CommonImplementor": { | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/SecondHierarchy" | ||
}, | ||
{ | ||
"$ref": "#/components/schemas/FirstHierarchy" | ||
} | ||
] | ||
}, | ||
"SecondHierarchy": { | ||
"required": [ | ||
"@type" | ||
], | ||
"type": "object", | ||
"properties": { | ||
"@type": { | ||
"type": "string" | ||
} | ||
}, | ||
"discriminator": { | ||
"propertyName": "@type" | ||
} | ||
}, | ||
"SecondHierarchyUser": { | ||
"type": "object", | ||
"properties": { | ||
"secondHierarchy": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/CommonImplementor" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"FirstHierarchy": { | ||
"required": [ | ||
"@type" | ||
], | ||
"type": "object", | ||
"properties": { | ||
"@type": { | ||
"type": "string" | ||
} | ||
}, | ||
"discriminator": { | ||
"propertyName": "@type" | ||
} | ||
}, | ||
"FirstHierarchyUser": { | ||
"type": "object", | ||
"properties": { | ||
"firstHierarchy": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/CommonImplementor" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |