|
34 | 34 | import com.fasterxml.jackson.databind.node.NumericNode;
|
35 | 35 | import com.fasterxml.jackson.databind.node.ObjectNode;
|
36 | 36 | import com.fasterxml.jackson.databind.node.TextNode;
|
| 37 | + |
37 | 38 | import io.swagger.models.ArrayModel;
|
38 | 39 | import io.swagger.models.ComposedModel;
|
39 | 40 | import io.swagger.models.Contact;
|
|
46 | 47 | import io.swagger.models.Path;
|
47 | 48 | import io.swagger.models.RefModel;
|
48 | 49 | import io.swagger.models.RefPath;
|
| 50 | +import io.swagger.models.RefResponse; |
49 | 51 | import io.swagger.models.Response;
|
50 | 52 | import io.swagger.models.Scheme;
|
51 | 53 | import io.swagger.models.SecurityRequirement;
|
@@ -611,6 +613,10 @@ private Property schema(Map<String, Object> schemaItems, JsonNode obj, String lo
|
611 | 613 | public RefParameter refParameter(TextNode obj, String location, ParseResult result) {
|
612 | 614 | return new RefParameter(obj.asText());
|
613 | 615 | }
|
| 616 | + |
| 617 | + public RefResponse refResponse(TextNode obj, String location, ParseResult result) { |
| 618 | + return new RefResponse(obj.asText()); |
| 619 | + } |
614 | 620 |
|
615 | 621 | public Path pathRef(TextNode ref, String location, ParseResult result) {
|
616 | 622 | RefPath output = new RefPath();
|
@@ -944,6 +950,16 @@ public Response response(ObjectNode node, String location, ParseResult result) {
|
944 | 950 | return null;
|
945 | 951 |
|
946 | 952 | Response output = new Response();
|
| 953 | + JsonNode ref = node.get("$ref"); |
| 954 | + if(ref != null) { |
| 955 | + if(ref.getNodeType().equals(JsonNodeType.STRING)) { |
| 956 | + return refResponse((TextNode) ref, location, result); |
| 957 | + } |
| 958 | + else { |
| 959 | + result.invalidType(location, "$ref", "string", node); |
| 960 | + return null; |
| 961 | + } |
| 962 | + } |
947 | 963 |
|
948 | 964 | String value = getString("description", node, true, location, result);
|
949 | 965 | output.description(value);
|
|
0 commit comments