You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The model resolver is skipping properties in the specific scenario:
there's a resource returning class A
class A contains property of type: collection of B
class B contains property of type: collection of B
The B collection property is missing in the schema definition
Below code example, that reproduces the issue. DataResponse has property buckets (List<BucketResponse>). BucketResponse has property buckets (List<BucketResponse>).
The BucketResponse.buckets property is missing in the OpenAPI schema.
package swagger.model.issue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.jaxrs2.integration.XmlWebOpenApiContext;
import io.swagger.v3.oas.integration.SwaggerConfiguration;
import io.swagger.v3.oas.models.OpenAPI;
import static java.util.Collections.singleton;
public class SwaggerModelIssueTest {
public static void main(String[] args) throws Exception {
SwaggerConfiguration oasConfig = new SwaggerConfiguration()
.resourcePackages(singleton("swagger.model.issue"))
.readAllResources(true);
OpenAPI openAPI =
new XmlWebOpenApiContext<>().openApiConfiguration(oasConfig)
.init()
.read();
System.out.println(Json.pretty(openAPI));
assert(openAPI.getComponents().getSchemas().get("BucketResponse").getProperties().containsKey("buckets"));
}
public static class DataResponse {
private String value;
private List<BucketResponse> buckets;
public String getValue() {
return value;
}
public List<BucketResponse> getBuckets() {
return buckets;
}
}
public static class BucketResponse {
private String value;
private List<BucketResponse> buckets;
public String getValue() {
return value;
}
public List<BucketResponse> getBuckets() {
return buckets;
}
}
@Path("/data")
@Produces(MediaType.APPLICATION_JSON)
public static class DataResource {
@POST
@Path("/")
public DataResponse getData() {
return new DataResponse();
}
}
}
The text was updated successfully, but these errors were encountered:
Please raise tooling-related issues on the relevant repository. This repository is for the OpenAPI specification itself. You may also receive more answers on a general support forum such as StackOverflow. Thanks.
Version: io.swagger.vore.v3:swagger-core:2.1.1
The model resolver is skipping properties in the specific scenario:
The B collection property is missing in the schema definition
Below code example, that reproduces the issue.
DataResponse has property
buckets
(List<BucketResponse>
).BucketResponse has property
buckets
(List<BucketResponse>
).The
BucketResponse.buckets
property is missing in the OpenAPI schema.The text was updated successfully, but these errors were encountered: