-
-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No empty description for polymorphic subtypes #2371
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
17 changes: 17 additions & 0 deletions
17
...s/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/app170/Animal.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,17 @@ | ||
package test.org.springdoc.api.app170; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
/** | ||
* Interface of the Animal. | ||
*/ | ||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = Dog.class, name = "dog"), | ||
@JsonSubTypes.Type(value = Cat.class, name = "cat"), | ||
}) | ||
@Schema(description = "Represents an Animal class.") | ||
public interface Animal {} |
19 changes: 19 additions & 0 deletions
19
...oc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/app170/BasicController.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,19 @@ | ||
package test.org.springdoc.api.app170; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping(path = "/") | ||
public class BasicController { | ||
|
||
@GetMapping("/test1") | ||
@Operation(summary = "get1", description = "Provides an animal.") | ||
public Animal get1() { | ||
|
||
return new Dog("Foo", 12); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/app170/Cat.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,22 @@ | ||
package test.org.springdoc.api.app170; | ||
|
||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema | ||
public class Cat implements Animal { | ||
|
||
private Integer speed; | ||
|
||
public Cat(Integer speed) { | ||
this.speed = speed; | ||
} | ||
|
||
public Integer getSpeed() { | ||
return speed; | ||
} | ||
|
||
public void setSpeed(Integer speed) { | ||
this.speed = speed; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/app170/Dog.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,33 @@ | ||
package test.org.springdoc.api.app170; | ||
|
||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "Represents a Dog class.") | ||
public class Dog implements Animal { | ||
|
||
private String name; | ||
|
||
private Integer age; | ||
|
||
public Dog(String name, Integer age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public Integer getAge() { | ||
return age; | ||
} | ||
|
||
public void setAge(Integer age) { | ||
this.age = age; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...penapi-javadoc-tests/src/test/java/test/org/springdoc/api/app170/SpringDocApp170Test.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,37 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2023 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.app170; | ||
|
||
import test.org.springdoc.api.AbstractSpringDocTest; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* The type Spring doc app 193 test. | ||
*/ | ||
public class SpringDocApp170Test extends AbstractSpringDocTest { | ||
|
||
/** | ||
* The type Spring doc test app. | ||
*/ | ||
@SpringBootApplication | ||
static class SpringDocTestApp { | ||
} | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
...gdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/app170.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,90 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/test1": { | ||
"get": { | ||
"tags": [ | ||
"basic-controller" | ||
], | ||
"summary": "get1", | ||
"description": "Provides an animal.", | ||
"operationId": "get1", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/Cat" | ||
}, | ||
{ | ||
"$ref": "#/components/schemas/Dog" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Animal": { | ||
"type": "object", | ||
"description": "Represents an Animal class." | ||
}, | ||
"Cat": { | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/Animal" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"speed": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"Dog": { | ||
"type": "object", | ||
"description": "Represents a Dog class.", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/Animal" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice missing class Javadoc (and no explicit description set on
@Schema
), which should translate to nullSchema.description