Hi
I have up running project and decided to integrate swagger.
I am using jersey 2 .
so, i got an api response that i converted in to jsonschema and generated a
pojo class. using something like below i am able to show the model schema
of the response
@GET
@ApiOperation(value="Retrives all items" , response =
/path/to/.class/in/the jar.class )
@Produces({MediaType.APPLICATION_JSON})
public getStoreitems(......)
Below is the schema of my response from api and along with the generated
POJO that i am using to point in the
@Apioperation(@ApiOperation(value="Retrives all items" , response =
/path/to/.class/in/the jar.class )
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"storeitem": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"id",
"storeitem",
"description"
]
}
pojo class
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({
"id",
"storeitem",
"description"
})
public class Example {
/**
*
* (Required)
*
*/
@JsonProperty("id")
private String id;
/**
*
* (Required)
*
*/
@JsonProperty("storeitem")
private String storeitem;
/**
*
* (Required)
*
*/
@JsonProperty("description")
private String description;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String,
Object>();
/**
*
* (Required)
*
* @return
* The id
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
*
* (Required)
*
* @param id
* The id
*/
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
/**
*
* (Required)
*
* @return
* The storeitem
*/
@JsonProperty("storeitem")
public String getStoreitem() {
return storeitem;
}
/**
*
* (Required)
*
* @param storeitem
* The storeitem
*/
@JsonProperty("storeitem")
public void setStoreitem(String storeitem) {
this.storeitem = storeitem;
}
/**
*
* (Required)
*
* @return
* The description
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
/**
*
* (Required)
*
* @param description
* The description
*/
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
on the UI Model scheam, i am expecting something like this.
[
{
"id": "string",
"storeitem": "string",
"description": "string"
}
]
but what i get
{
"id": "string", "storeitem": "string", "description": "string" }
Thanks
devin
--
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.