Models in Java
lyricllie519 opened this issue · 2 comments
lyricllie519 commented
Hi, There.
I am coding Play framework project in Java, and using play-swagger. This is amazing library.
I want to know how can I get defined parameter name in swagger?
Constructor in models
public OrderForm(Long orderId, User user, Integer totalPrice, Long shopId, String receiveDate, Integer orderStatus) {
this.orderId = orderId;
this.user = user;
this.totalPrice = totalPrice;
this.shopId = shopId;
this.receiveDate = receiveDate;
this.orderStatus = orderStatus;
}
In Routes file
# parameters:
# - name: body
# schema:
# $ref: '#/definitions/controllers.admin.forms.OrderForm'
Output parameter in swagger
{
"x$1": 0,
"x$2": {},
"x$3": 0,
"x$4": 0,
"x$5": "string",
"x$6": 0
}
-> I wanna get defined parameter name like "orderId" instead of "x$1".
thirdteeth commented
there is a flag swaggerPlayJava for using Jackson ObjectMapper to get all properties, you can put swaggerPlayJava := true in your sbt file and enable it, it only works for play 2.7 right now
lyricllie519 commented
Thank you so much for letting me know about flag "swaggerPlayJava", It worked!!
It's very easy and amazing:-D