Skip to content

Commit

Permalink
fix: refs #1552 - fix response schema conversion v2->v3
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Nov 12, 2022
1 parent f9d8633 commit 574e64a
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,8 @@ public ApiResponse convert(io.swagger.models.Response v2Response, List<String> p

response.setDescription(v2Response.getDescription());

if (v2Response.getSchema() != null) {
Schema schema = convertFileSchema(convert(v2Response.getSchema()));
if (v2Response.getResponseSchema() != null) {
Schema schema = convertFileSchema(convert(v2Response.getResponseSchema()));
for (String type : mediaTypes) {
// TODO: examples
MediaType mediaType = new MediaType();
Expand Down Expand Up @@ -961,8 +961,7 @@ private Schema convert(Property schema) {
result = arraySchema;

} else if (schema instanceof FileProperty) {
FileSchema fileSchema = Json.mapper().convertValue(schema, FileSchema.class);
result = fileSchema;
result = Json.mapper().convertValue(schema, FileSchema.class);

}else {

Expand Down Expand Up @@ -1208,9 +1207,11 @@ public Schema convert(io.swagger.models.Model v2Model) {
v2discriminator = model.getDiscriminator();
model.setDiscriminator(null);
}

result = Json.mapper().convertValue(v2Model, Schema.class);

if (v2Model instanceof ModelImpl && ("file".equals(((ModelImpl)v2Model).getType()))) {
result = Json.mapper().convertValue(v2Model, FileSchema.class);
} else {
result = Json.mapper().convertValue(v2Model, Schema.class);
}
addProperties(v2Model, result);

if (v2Model instanceof ModelImpl) {
Expand Down

0 comments on commit 574e64a

Please sign in to comment.