Which version of swagger-ui do you use?

Can you provide the full output spec?

 

 

 

From: <[email protected]> on behalf of 
"[email protected]" <[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, 21 November 2016 at 1:03
To: Swagger <[email protected]>
Subject: show xml schema

 

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

 

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.


-- 
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.

Reply via email to