fixed ref parsing
@@ -27,6 +27,7 @@ import v2.io.swagger.models.Path;
import v2.io.swagger.models.RefModel;
import v2.io.swagger.models.Swagger;
import v2.io.swagger.models.parameters.BodyParameter;
+import v2.io.swagger.models.parameters.RefParameter;
import v2.io.swagger.models.parameters.SerializableParameter;
import v2.io.swagger.models.properties.Property;
import v2.io.swagger.models.properties.RefProperty;
@@ -403,9 +404,14 @@ public class SwaggerConverter implements SwaggerParserExtension {
v3Parameter.setIn(v2Parameter.getIn());
v3Parameter.setName(v2Parameter.getName());
+ Schema schema = null;
+
+ if(v2Parameter instanceof RefParameter) {
+ schema = new Schema().ref(((RefParameter) v2Parameter).get$ref());
+ }
+ else if(v2Parameter instanceof SerializableParameter) {
SerializableParameter sp = (SerializableParameter) v2Parameter;
- Schema schema = null;
if ("array".equals(sp.getType())) {
ArraySchema a = new ArraySchema();
// TODO: convert arrays to proper template format
@@ -422,8 +428,7 @@ public class SwaggerConverter implements SwaggerParserExtension {
}
schema = a;
- }
- else {
+ } else {
schema = new Schema();
schema.setType(sp.getType());
schema.setFormat(sp.getFormat());
@@ -446,6 +451,7 @@ public class SwaggerConverter implements SwaggerParserExtension {
}
schema.setPattern(sp.getPattern());
}
+ }
if(v2Parameter.getRequired()) {
v3Parameter.setRequired(v2Parameter.getRequired());
