-
-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@JsonUnwrapped is ignored when PolymorphicConverter is enabled. Fixes #…
- Loading branch information
1 parent
1fc8f9d
commit 7bb5fc2
Showing
6 changed files
with
151 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
...openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app224/RootModel.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,27 @@ | ||
package test.org.springdoc.api.v30.app224; | ||
|
||
import com.fasterxml.jackson.annotation.JsonUnwrapped; | ||
|
||
public class RootModel { | ||
|
||
private Integer rootProperty; | ||
|
||
@JsonUnwrapped | ||
private UnwrappedModel unwrappedModel; | ||
|
||
public Integer getRootProperty() { | ||
return rootProperty; | ||
} | ||
|
||
public void setRootProperty(Integer rootProperty) { | ||
this.rootProperty = rootProperty; | ||
} | ||
|
||
public UnwrappedModel getUnwrappedModel() { | ||
return unwrappedModel; | ||
} | ||
|
||
public void setUnwrappedModel(UnwrappedModel unwrappedModel) { | ||
this.unwrappedModel = unwrappedModel; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...arter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app224/SpringDocApp224Test.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,35 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * 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.app224; | ||
|
||
import test.org.springdoc.api.v30.AbstractSpringDocV30Test; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
public class SpringDocApp224Test extends AbstractSpringDocV30Test { | ||
|
||
@SpringBootApplication | ||
static class SpringDocTestApp {} | ||
} |
15 changes: 15 additions & 0 deletions
15
...pi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app224/TestController.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,15 @@ | ||
package test.org.springdoc.api.v30.app224; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
public class TestController { | ||
|
||
@GetMapping | ||
public RootModel getRootModel() { | ||
return new RootModel(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...pi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app224/UnwrappedModel.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,14 @@ | ||
package test.org.springdoc.api.v30.app224; | ||
|
||
public class UnwrappedModel { | ||
|
||
private Integer unwrappedProperty; | ||
|
||
public Integer getUnwrappedProperty() { | ||
return unwrappedProperty; | ||
} | ||
|
||
public void setUnwrappedProperty(Integer unwrappedProperty) { | ||
this.unwrappedProperty = unwrappedProperty; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app224.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,52 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/api": { | ||
"get": { | ||
"tags": [ | ||
"test-controller" | ||
], | ||
"operationId": "getRootModel", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"$ref": "#/components/schemas/RootModel" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"RootModel": { | ||
"type": "object", | ||
"properties": { | ||
"rootProperty": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"unwrappedProperty": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |