Swagger Doc annotations issue. Skip a variable

720 views
Skip to first unread message

Ritwick Gupta

unread,
Apr 15, 2014, 12:30:20 PM4/15/14
to swagger-sw...@googlegroups.com
Hello Everyone,

I am using swagger docs with my API. It displays content of my Response Class as follows:

Order {
customer (CustomerInfooptional),
order_type (stringoptional),
order_payments (array[order_payment]optional),
externalPayment (ExternalPaymentoptional),
delivery_address (Addressoptional),
order_items (array[SingleOrderItem]optional),
order_specials (array[SpecialOrderItem]optional),
order_id (stringoptional),
order_number (stringoptional),
delivery_instructions (stringoptional),
order_date (stringoptional),
subtotal (BigDecimaloptional),
total_tax (BigDecimaloptional),
grand_total (BigDecimaloptional),
order_status (OrderStatusoptional) = ['BEING_PREPARED' or 'READY' or 'OUT_FOR_DELIVERY' or 'BAD_ORDER_CANCELLED' or 'UNPROCESSED' or 'PROCESSED' or 'ERROR'],
pos_id (stringoptional),
external_id (stringoptional),
want_date (stringoptional),
quoted_time (stringoptional),
percent_discount (BigDecimaloptional),
order_credits (array[OrderAmount]optional),
order_charges (array[OrderAmount]optional)
}

I was curious if there is a way to change (optional) inside the bracket to something like like "required"? What does optional indicate?

Secondly, if I want certain variables to not show up on this document but I want them to stay in my code, is there an annotation to skip them? I don't want to confuse the developers with variables they don't require.

Lastly, I have following code in my file

@ApiModelProperty(value = "The order type", required = true, allowableValues = "pickup,delivery")
    public void setOrder_type(String order_type) {
        this.order_type = order_type;
    }

Where do I see this value, required and allowableValues on the doc? They are not being displayed anywhere.

Ron

unread,
Apr 15, 2014, 12:39:43 PM4/15/14
to swagger-sw...@googlegroups.com
Hi,

You can do everything you're looking for (I assume you use version 1.3.4 of Swagger-Core).

To make a model field mandatory, you need to set the 'required' field of the @ApiModelProperty to true - https://github.com/wordnik/swagger-core/blob/master/modules/swagger-annotations/src/main/java/com/wordnik/swagger/annotations/ApiModelProperty.java#L64

To hide certain fields, there are several ways, but the easiest one for your use case would be to use the 'hidden' parameter - https://github.com/wordnik/swagger-core/blob/master/modules/swagger-annotations/src/main/java/com/wordnik/swagger/annotations/ApiModelProperty.java#L75 - set it to true, and it will not be documented.

As for the last question - to be clear, are you not seeing them in the swagger-ui or n the resulting json from swagger-core?


--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ritwick Gupta

unread,
Apr 15, 2014, 12:44:49 PM4/15/14
to swagger-sw...@googlegroups.com
I am using 1.3.0 as of right now. 

 <!-- Swagger Stuff -->
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-core_2.10</artifactId>
            <version>1.3.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-jaxrs_2.10</artifactId>
            <version>1.3.0</version>
            <scope>compile</scope>
        </dependency>

Should I change it to 1.3.4? Also will there be any issue if I do that? 
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ritwick Gupta

unread,
Apr 15, 2014, 12:46:23 PM4/15/14
to swagger-sw...@googlegroups.com
Also I am not seeing them in swagger UI. Can it be as I am using an older version of swagger? Also, how do I get resulting JSON from swagger core? 

Ron

unread,
Apr 15, 2014, 12:47:31 PM4/15/14
to swagger-sw...@googlegroups.com
You should definitely change it to 1.3.4.

The URL you input to Swagger-UI to see your documentation - if you just open that in your browser, you'll get the resulting json.


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Ritwick Gupta

unread,
Apr 15, 2014, 1:01:31 PM4/15/14
to swagger-sw...@googlegroups.com
Ok so I can't see it in both, swagger UI and Resulting Json
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron

unread,
Apr 15, 2014, 1:03:37 PM4/15/14
to swagger-sw...@googlegroups.com
Is it also the case after upgrading to 1.3.4?


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Ritwick Gupta

unread,
Apr 15, 2014, 1:09:08 PM4/15/14
to swagger-sw...@googlegroups.com
I guess yes. I changed version to 1.3.4 in my POM file and recompiled and deployed it. Still nothing. Is there a way of knowing from the UI which version of swagger docs am I using? 

Btw thanks a lot for all the help. I am a swagger newbie :) 

Ron

unread,
Apr 15, 2014, 1:10:31 PM4/15/14
to swagger-sw...@googlegroups.com
No, the Swagger-UI won't display the version of Swagger-Core as they are completely independent.
Can you share the json you're getting?


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Ritwick Gupta

unread,
Apr 15, 2014, 1:20:51 PM4/15/14
to swagger-sw...@googlegroups.com
This is the main api json 

{
    "apiVersion": "1.0.0",
    "swaggerVersion": "1.2",
    "apis": [{
        "path": "/chains"
    }, {
        "path": "/stores/{id}/menu"
    }, {
        "path": "/stores"
    }, {
        "path": "/stores/{id}/orders"
    }, {
        "path": "/customers"
    }],
    "info": {
        "title": "xxxx Developer API",
        "description": "The API has been designed",
        "contact": "a...@xxxx.com"
    }
}

the order api json is

{

    "apiVersion": "1.0.0",

    "swaggerVersion": "1.2",

    "basePath": "https://xxxx-prod.apigee.net/v1",

    "resourcePath": "/stores/{id}/orders",

    "produces": ["application/json", "application/xml"],

    "apis": [{

        "path": "/stores/{id}/orders",

        "operations": [{

            "method": "GET",

            "summary": "Retrieve a list of orders for the requested store ID",

            "notes": "",

            "type": "OrderListResponse",

            "nickname": "getStoreOrders",

            "authorizations": {},

            "parameters": [{

                "name": "id",

                "description": "The ID of the store to retrieve",

                "required": true,

                "type": "string",

                "paramType": "path",

                "allowMultiple": false

            }, {

                "name": "apikey",

                "description": "API consumer key",

                "required": true,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "fields",

                "description": "Comma separated list of fields to return",

                "required": false,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "offset",

                "description": "Number of records to offset before returning first record",

                "defaultValue": "0",

                "required": false,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "limit",

                "description": "Number of records to return",

                "defaultValue": "10",

                "required": false,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }],

            "responseMessages": [{

                "code": 401,

                "message": "This IP address has been blocked. Please contact xxxx support at sup...@xxxx.com.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "The provided credentials were invalid. Please provide a valid API username and key.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "This IP address has not been setup to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 403,

                "message": "The provided user must accept the Terms and Conditions before you are able to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 404,

                "message": "The requested store ID was not found.",

                "responseModel": "errors"

            }]

        }]

    }, {

        "path": "/stores/{id}/orders/{order_id}",

        "operations": [{

            "method": "GET",

            "summary": "Retrieve an order identified by its unique ID",

            "notes": "",

            "type": "OrderResponse",

            "nickname": "getStoreOrder",

            "authorizations": {},

            "parameters": [{

                "name": "id",

                "description": "The ID of the store to retrieve",

                "required": true,

                "type": "string",

                "paramType": "path",

                "allowMultiple": false

            }, {

                "name": "order_id",

                "description": "The ID of the order to retrieve",

                "required": true,

                "type": "string",

                "paramType": "path",

                "allowMultiple": false

            }, {

                "name": "apikey",

                "description": "API consumer key",

                "required": true,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "fields",

                "description": "Comma separated list of fields to return",

                "required": false,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }],

            "responseMessages": [{

                "code": 401,

                "message": "This IP address has been blocked. Please contact xxxx support at sup...@xxxx.com.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "The provided credentials were invalid. Please provide a valid API username and key.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "This IP address has not been setup to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 403,

                "message": "The provided user must accept the Terms and Conditions before you are able to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 404,

                "message": "The requested store ID was not found.",

                "responseModel": "errors"

            }, {

                "code": 404,

                "message": "The requested order ID was not found.",

                "responseModel": "errors"

            }]

        }]

    }, {

        "path": "/stores/{id}/orders/calculate",

        "operations": [{

            "method": "POST",

            "summary": "Validate and calculate an order for the store identified by ID",

            "notes": "Need Something Here",

            "type": "OrderResponse",

            "nickname": "calculateOrder",

            "authorizations": {},

            "parameters": [{

                "name": "id",

                "description": "The ID of the store to submit the order to",

                "required": true,

                "type": "string",

                "paramType": "path",

                "allowMultiple": false

            }, {

                "name": "check_location",

                "description": "Check location to a Order type delivery",

                "required": false,

                "type": "boolean",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "apikey",

                "description": "API consumer key",

                "required": true,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "body",

                "description": "The Order to submit to the point of sale system.",

                "required": true,

                "type": "Order",

                "paramType": "body",

                "allowMultiple": false

            }],

            "responseMessages": [{

                "code": 401,

                "message": "This IP address has been blocked. Please contact xxxx support at sup...@xxxx.com.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "The provided credentials were invalid. Please provide a valid API username and key.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "This IP address has not been setup to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 403,

                "message": "The provided user must accept the Terms and Conditions before you are able to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 404,

                "message": "The requested store ID was not found.",

                "responseModel": "errors"

            }]

        }]

    }, {

        "path": "/stores/{id}/orders/create",

        "operations": [{

            "method": "POST",

            "summary": "Submit an order down the point of sale system for the store identified by ID",

            "notes": "Need Something Here",

            "type": "OrderResponse",

            "nickname": "createOrder",

            "authorizations": {},

            "parameters": [{

                "name": "id",

                "description": "The ID of the store to submit the order to",

                "required": true,

                "type": "string",

                "paramType": "path",

                "allowMultiple": false

            }, {

                "name": "apikey",

                "description": "API consumer key",

                "required": true,

                "type": "string",

                "paramType": "query",

                "allowMultiple": false

            }, {

                "name": "body",

                "description": "The Order to submit to the point of sale system.",

                "required": true,

                "type": "Order",

                "paramType": "body",

                "allowMultiple": false

            }],

            "responseMessages": [{

                "code": 401,

                "message": "This IP address has been blocked. Please contact xxxx support at sup...@xxxx.com.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "The provided credentials were invalid. Please provide a valid API username and key.",

                "responseModel": "errors"

            }, {

                "code": 401,

                "message": "This IP address has not been setup to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 403,

                "message": "The provided user must accept the Terms and Conditions before you are able to make API requests.",

                "responseModel": "errors"

            }, {

                "code": 404,

                "message": "The requested store ID was not found.",

                "responseModel": "errors"

            }]

        }]

    }],

    "models": {

        "order_payment": {

            "id": "order_payment",

            "properties": {

                "payment_type": {

                    "type": "string"

                },

                "payment_tendered": {

                    "type": "number",

                    "format": "double"

                },

                "credit_card": {

                    "$ref": "CreditCard"

                }

            }

        },

        "CreditCard": {

            "id": "CreditCard",

            "properties": {

                "card_type": {

                    "type": "string"

                },

                "card_number": {

                    "type": "string"

                },

                "expire_year": {

                    "type": "string"

                },

                "expire_month": {

                    "type": "string"

                },

                "cvv2": {

                    "type": "string"

                },

                "first_name": {

                    "type": "string"

                },

                "last_name": {

                    "type": "string"

                },

                "billing_address": {

                    "$ref": "Address"

                }

            }

        },

        "Address": {

            "id": "Address",

            "properties": {

                "id": {

                    "type": "string"

                },

                "type": {

                    "type": "string"

                },

                "suite_number": {

                    "type": "string"

                },

                "street_number": {

                    "type": "string"

                },

                "street": {

                    "type": "string"

                },

                "city": {

                    "type": "string"

                },

                "province_state": {

                    "type": "string"

                },

                "postal_zip": {

                    "type": "string"

                },

                "country": {

                    "type": "string"

                },

                "nickname": {

                    "type": "string"

                },

                "notes": {

                    "type": "string"

                },

                "default": {

                    "type": "boolean"

                }

            }

        },

        "PhoneNumber": {

            "id": "PhoneNumber",

            "properties": {

                "type": {

                    "type": "string"

                },

                "area_code": {

                    "type": "string"

                },

                "number": {

                    "type": "string"

                }

            }

        },

        "OrderResponse": {

            "id": "OrderResponse",

            "properties": {

                "order": {

                    "$ref": "Order"

                }

            }

        },

        "errors": {

            "id": "errors",

            "properties": {

                "error": {

                    "type": "array",

                    "uniqueItems": true,

                    "items": {

                        "$ref": "error"

                    }

                }

            }

        },

        "CustomerInfo": {

            "id": "CustomerInfo",

            "properties": {

                "customer_id": {

                    "type": "string"

                },

                "first_name": {

                    "type": "string"

                },

                "last_name": {

                    "type": "string"

                },

                "gender": {

                    "type": "string"

                },

                "birth_date": {

                    "type": "string"

                },

                "email_address": {

                    "type": "string"

                },

                "phone_number": {

                    "$ref": "PhoneNumber"

                },

                "address": {

                    "$ref": "Address"

                },

                "guest": {

                    "type": "boolean"

                },

                "enabled": {

                    "type": "boolean"

                },

                "password": {

                    "type": "string"

                },

                "opt_in": {

                    "type": "boolean"

                },

                "link": {

                    "type": "array",

                    "items": {

                        "$ref": "Link"

                    }

                }

            }

        },

        "error": {

            "id": "error",

            "properties": {

                "code": {

                    "type": "string"

                },

                "description": {

                    "type": "string"

                },

                "httpCode": {

                    "type": "string"

                }

            }

        },

        "OrderItem": {

            "id": "OrderItem",

            "properties": {

                "menu_item_id": {

                    "type": "string"

                },

                "menu_item_name": {

                    "type": "string"

                },

                "line_number": {

                    "type": "integer",

                    "format": "int32"

                },

                "notes": {

                    "type": "string"

                },

                "quantity": {

                    "type": "string"

                },

                "variant_id": {

                    "type": "string"

                },

                "variant_name": {

                    "type": "string"

                },

                "total": {

                    "type": "number",

                    "format": "double"

                },

                "content": {

                    "type": "array",

                    "items": {

                        "$ref": "OrderItemContent"

                    }

                }

            }

        },

        "OrderAmount": {

            "id": "OrderAmount",

            "properties": {

                "name": {

                    "type": "string"

                },

                "amount": {

                    "type": "number",

                    "format": "double"

                }

            }

        },

        "Order": {

            "id": "Order",

            "description": "",

            "properties": {

                "order_id": {

                    "type": "string"

                },

                "pos_id": {

                    "type": "string"

                },

                "external_id": {

                    "type": "string"

                },

                "order_number": {

                    "type": "string"

                },

                "order_type": {

                    "type": "string"

                },

                "order_status": {

                    "$ref": "OrderStatus",

                    "enum": ["BEING_PREPARED", "READY", "OUT_FOR_DELIVERY", "BAD_ORDER_CANCELLED", "UNPROCESSED", "PROCESSED", "ERROR"]

                },

                "order_date": {

                    "type": "string",

                    "format": "date-time"

                },

                "required_date": {

                    "type": "string",

                    "format": "date-time"

                },

                "quoted_time": {

                    "type": "string"

                },

                "customer": {

                    "$ref": "CustomerInfo"

                },

                "delivery_address": {

                    "$ref": "Address"

                },

                "delivery_instructions": {

                    "type": "string"

                },

                "percent_discount": {

                    "type": "number",

                    "format": "double"

                },

                "subtotal": {

                    "type": "number",

                    "format": "double"

                },

                "total_tax": {

                    "type": "number",

                    "format": "double"

                },

                "final_total": {

                    "type": "number",

                    "format": "double"

                },

                "externalPayment": {

                    "$ref": "ExternalPayment"

                },

                "order_item": {

                    "type": "array",

                    "items": {

                        "$ref": "OrderItem"

                    }

                },

                "order_special": {

                    "type": "array",

                    "items": {

                        "$ref": "SpecialOrderItem"

                    }

                },

                "order_payment": {

                    "type": "array",

                    "items": {

                        "$ref": "order_payment"

                    }

                },

                "order_credit": {

                    "type": "array",

                    "items": {

                        "$ref": "OrderAmount"

                    }

                },

                "order_charge": {

                    "type": "array",

                    "items": {

                        "$ref": "OrderAmount"

                    }

                }

            }

        },

        "SpecialOrderItem": {

            "id": "SpecialOrderItem",

            "properties": {

                "order_item_id": {

                    "type": "string"

                },

                "quantity": {

                    "type": "string"

                },

                "total": {

                    "type": "number",

                    "format": "double"

                },

                "item": {

                    "type": "array",

                    "items": {

                        "$ref": "OrderItem"

                    }

                }

            }

        },

        "OrderItemContent": {

            "id": "OrderItemContent",

            "properties": {

                "modifier_id": {

                    "type": "string"

                },

                "modifier_name": {

                    "type": "string"

                },

                "portion_id": {

                    "type": "string"

                },

                "portion_name": {

                    "type": "string"

                },

                "amount_id": {

                    "type": "string"

                },

                "amount_name": {

                    "type": "string"

                }

            }

        },

        "ExternalPayment": {

            "id": "ExternalPayment",

            "properties": {

                "merchantVendor": {

                    "type": "string"

                },

                "customerName": {

                    "type": "string"

                },

                "amount": {

                    "type": "string"

                },

                "expDate": {

                    "type": "string"

                },

                "currency": {

                    "type": "string"

                },

                "authCode": {

                    "type": "string"

                },

                "authStatus": {

                    "type": "string"

                },

                "avsStatus": {

                    "type": "string"

                },

                "cvvStatus": {

                    "type": "string"

                },

                "invoice": {

                    "type": "string"

                },

                "memo": {

                    "type": "string"

                },

                "token": {

                    "type": "string"

                },

                "cardType": {

                    "type": "string"

                },

                "maskedAccount": {

                    "type": "string"

                },

                "merchantReferenceCode": {

                    "type": "string"

                },

                "acqRefData": {

                    "type": "string"

                },

                "processData": {

                    "type": "string"

                },

                "statusMessage": {

                    "type": "string"

                }

            }

        },

        "OrderListResponse": {

            "id": "OrderListResponse",

            "properties": {

                "metadata": {

                    "$ref": "ApiListMetadata"

                },

                "order": {

                    "type": "array",

                    "items": {

                        "$ref": "Order"

                    }

                }

            }

        },

        "Link": {

            "id": "Link",

            "properties": {

                "rel": {

                    "type": "string"

                },

                "href": {

                    "type": "string"

                }

            }

        },

        "ApiListMetadata": {

            "id": "ApiListMetadata",

            "properties": {

                "offset": {

                    "type": "integer",

                    "format": "int32"

                },

                "limit": {

                    "type": "integer",

                    "format": "int32"

                },

                "total": {

                    "type": "integer",

                    "format": "int32"

Ron

unread,
Apr 15, 2014, 1:32:33 PM4/15/14
to swagger-sw...@googlegroups.com
I assume this is the Order model.
Is it possible for you to share the full java class of Order?


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Ritwick Gupta

unread,
Apr 15, 2014, 1:34:38 PM4/15/14
to swagger-sw...@googlegroups.com
Sure

package com.xxxx.api.model.order;

import com.xxxx.api.model.*;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;

import javax.xml.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@XmlType(name = "", propOrder = {
        "order_id",
        "pos_id",
        "external_id",
        "order_number",

        "order_type",
        "order_status",

        "order_date",
        "required_date",
        "quoted_time",

        "order_payments",
        "customer",

        "delivery_address",
        "delivery_instructions",

        "order_specials",
        "order_items",

        "order_credits",
        "order_charges",
        "percent_discount",
        "subtotal",
        "total_tax",
        "final_total",
        "externalPayment"
})
@XmlRootElement
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@ApiModel(value = "The order to submit to the point of sale.")
@JsonRootName(value = "order")
public class Order extends BaseWebserviceObject {

    public enum OrderStatus {
        BEING_PREPARED,
        READY,
        OUT_FOR_DELIVERY,
        BAD_ORDER_CANCELLED,
        UNPROCESSED,
        PROCESSED,
        ERROR
    }

    private String order_id;
    private String pos_id;
    private String external_id;
    private String order_number;

    private String order_type;
    private OrderStatus order_status;

    private Date order_date;
    private Date required_date;
    private String quoted_time;

    @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
    private List<OrderPayment> order_payments;
    private CustomerInfo customer;

    private Address delivery_address;
    private String delivery_instructions;

    @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
    private List<SpecialOrderItem> order_specials;
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
    private List<OrderItem> order_items;
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
    private List<OrderAmount> order_credits;
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
    private List<OrderAmount> order_charges;

    private double percent_discount;
    private double subtotal;
    private double total_tax;
    private double final_total;
    private ExternalPayment externalPayment;

    public Order() {}

    public String getOrder_id() {
        return order_id;
    }

    public void setOrder_id(String order_number) {
        this.order_id = order_number;
    }

    public String getOrder_number() {
        return order_number;
    }

    public void setOrder_number(String order_number) {
        this.order_number = order_number;
    }

    public CustomerInfo getCustomer() {
        return customer;
    }

    @ApiModelProperty(value = "The ordering customer information", required = true)
    public void setCustomer(CustomerInfo customer) {
        this.customer = customer;
    }

    public Address getDelivery_address() {
        return delivery_address;
    }

    @ApiModelProperty(value = "The delivery address of the order - required if type is 'delivery'", required = false)
    public void setDelivery_address(Address delivery_address) {
        this.delivery_address = delivery_address;
    }

    public String getOrder_type() {
        return order_type;
    }

    @ApiModelProperty(value = "The order type", required = true, allowableValues = "pickup,delivery")
    public void setOrder_type(String order_type) {
        this.order_type = order_type;
    }

    public String getDelivery_instructions() {
        return delivery_instructions;
    }

    @ApiModelProperty(value = "Instructions for the delivery driver")
    public void setDelivery_instructions(String delivery_instructions) {
        this.delivery_instructions = delivery_instructions;
    }

    public Date getOrder_date() {
        return order_date;
    }

    public void setOrder_date(Date order_date) {
        this.order_date = order_date;
    }

    public double getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(double subtotal) {
        this.subtotal = subtotal;
    }

    public double getTotal_tax() {
        return total_tax;
    }

    public void setTotal_tax(double total_tax) {
        this.total_tax = total_tax;
    }

    public double getFinal_total() {
        return final_total;
    }

    public void setFinal_total(double final_total) {
        this.final_total = final_total;
    }

    public OrderStatus getOrder_status() {
        return order_status;
    }

    public void setOrder_status(OrderStatus order_status) {
        this.order_status = order_status;
    }

    @XmlElementWrapper(name="order_payments")
    @XmlElement(name="order_payment")
    public List<OrderPayment> getOrder_payments(){
        return order_payments;
    }

    public void setOrder_payments(List<OrderPayment> payments){
        this.order_payments = payments;
    }

    public ExternalPayment getExternalPayment() {
        return externalPayment;
    }

    @ApiModelProperty(value = "The external payment information")
    public void setExternalPayment(ExternalPayment externalPayment) {
        this.externalPayment = externalPayment;
    }

    @XmlElementWrapper(name="order_specials")
    @XmlElement(name="order_special")
    public List<SpecialOrderItem> getOrder_specials() {
        return order_specials;
    }

    public void setOrder_specials(List<SpecialOrderItem> specials) {
        this.order_specials = specials;
    }

    @XmlElementWrapper(name="order_items")
    @XmlElement(name="order_item")
    public List<OrderItem> getOrder_items() {
        return order_items;
    }

    public void setOrder_items(List<OrderItem> items) {
        this.order_items = items;
    }

    public String getPos_id() {
        return pos_id;
    }

    public void setPos_id(String pos_id) {
        this.pos_id = pos_id;
    }

    public String getExternal_id() {
        return external_id;
    }

    public void setExternal_id(String external_id) {
        this.external_id = external_id;
    }

    public Date getRequired_date() {
        return required_date;
    }

    public void setRequired_date(Date required_date) {
        this.required_date = required_date;
    }

    public String getQuoted_time() {
        return quoted_time;
    }

    public void setQuoted_time(String quoted_time) {
        this.quoted_time = quoted_time;
    }

    public double getPercent_discount() {
        return percent_discount;
    }

    public void setPercent_discount(double percent_discount) {
        this.percent_discount = percent_discount;
    }

    @XmlElementWrapper(name="order_credits")
    @XmlElement(name="order_credit")
    public List<OrderAmount> getOrder_credits() {
        return order_credits;
    }

    public void setOrder_credits(List<OrderAmount> order_credits) {
        this.order_credits = order_credits;
    }

    @XmlElementWrapper(name="order_charges")
    @XmlElement(name="order_charge")
    public List<OrderAmount> getOrder_charges() {
        return order_charges;
    }

    public void setOrder_charges(List<OrderAmount> order_charges) {
        this.order_charges = order_charges;
...

tony tam

unread,
Apr 15, 2014, 1:49:59 PM4/15/14
to swagger-sw...@googlegroups.com
Howdy Ritwick,
By chance are you using EJBs or other injection framework?  We've seen the annotations being dropped with proxy classes.
Sure

  &nbs

...

Ritwick Gupta

unread,
Apr 15, 2014, 2:39:14 PM4/15/14
to swagger-sw...@googlegroups.com
Ok I found the problem. All the 2ApiModelProperty annotations were on setter functions and they needed to be on the getter function for them to work. 

But I am still not able to hide instances of a class in another class. example 

@ApiModelProperty(hidden = true)
    public String getPos_id() {
        return pos_id;
}

works properly but 

@XmlElementWrapper(name="order_specials")
    @XmlElement(name="order_special")
    @ApiModelProperty(hidden = true)
    public List<SpecialOrderItem> getOrder_specials() {
        return order_specials;
    }

doesn't work, where SpecialOrderItem is another class. 
Reply all
Reply to author
Forward
0 new messages