Hi
I'm using swagger-models-1.5.6, and trying to see xml inside my model
schema. for that I'm doing the following:
ModelImpl **xmlmodel** = new ModelImpl()
.xml(new Xml()
.name("user"))
.property(
"username",
new StringProperty()
.example("fehguy")
.xml(new Xml()
.name("userName")))
.property("addresses", new ArrayProperty()
.xml(new Xml().wrapped(true))
.items(new RefProperty("Address")))
.property("managers", new MapProperty()
.additionalProperties(new StringProperty().example("SVP
Engineering")))
.property("kidsAges", new ArrayProperty()
.items(new IntegerProperty().example(9)));
and using it:
Operation apiOperation = new Operation();
apiOperation.addConsumes(MediaType.APPLICATION_XML);
BodyParameter bodyParameter = new BodyParameter();
bodyParameter.name("body");
bodyParameter.setIn("body");
bodyParameter.setRequired(true);
bodyParameter.setSchema(**xmlmodel**);
apiOperation.addParameter(bodyParameter);
However- I see json in the model schema and not xml
[image: capturee]
<https://cloud.githubusercontent.com/assets/10425287/20475870/9cadbde8-afd6-11e6-9712-2e0e28de9f1e.PNG>
this is the json response from the server:
"post": {
"consumes": ["application/xml"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"properties": {
"username": {
"type": "string",
"example": "fehguy",
"xml": {
"name": "userName"
}
},
"addresses": {
"type": "array",
"xml": {
"wrapped": true
},
"items": {
"$ref": "#/definitions/Address"
}
},
"managers": {
"type": "object",
"additionalProperties": {
"type": "string",
"example": "SVP Engineering"
}
},
"kidsAges": {
"type": "array",
"items": {
"type": "integer",
"format": "int32",
"example": "9"
}
}
},
"xml": {
"name": "user"
}
}
}]
}
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.