camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-10821) Camel-swagger-java doesn't parse multiple required parameters
Date Mon, 13 Feb 2017 14:00:43 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-10821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15863712#comment-15863712
] 

Claus Ibsen commented on CAMEL-10821:
-------------------------------------

swagger is for creating the swagger doc - there is no validation etc on the rest consumer
in use in this module

> Camel-swagger-java doesn't parse multiple required parameters
> -------------------------------------------------------------
>
>                 Key: CAMEL-10821
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10821
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-swagger
>    Affects Versions: 2.18.0
>         Environment: Ubuntu 16.04
>            Reporter: Jeremy
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> This issue is related to camel-swagger-java (not camel-swagger)
> Simple Model :
> {code:title=Platform.java|borderStyle=solid}
> @ApiModel(description = "Represents a platform")
> public class Platform {
>     String name;
>     String owner;
>     public Platform() {}
>     @ApiModelProperty(value = "Name of the platform", required = true)
>     public String getName() {
>         return name;
>     }
>     public void setName(String name) {
>         this.name = name;
>     }
>     @ApiModelProperty(value = "Owner of the platform", required = true)
>     public String getOwner() {
>         return owner;
>     }
>     public void setOwner(String owner) {
>         this.owner = owner;
>     }
> }
> {code}
> Simple REST Definition :
> {code:title=RouteBuilder.java|borderStyle=solid}
> restConfiguration().component("netty4-http")
>             ...
>         rest("/platform").description("Deploy platform")
>                 .consumes("application/json").produces("application/json")
>                 .post("/deploy").description("Deploy platform").type(Platform.class)
>                 .param().name("body").type(body).description("Platform").endParam()
>                 .to("bean:platformController?method=deployPlatform");
> {code}
> Swagger.json is containing required parameters :
> {code:title=swagger.json|borderStyle=solid}
> "definitions": {
>         "Platform": {
>             "type": "object",
>             "required": [
>                 "name",
>                 "owner",
> ...
> {code}
> Now let's try a POST request without name value :
> {code:title=body.json|borderStyle=solid}
> {
>   "owner":"toto"
> }
> {code}
> {code:title=return.json|borderStyle=solid}
> {
>     "status": "failure",
>     "message": "Name must be provided."
> }
> {code}
> Here it's working fine, now let's try to remove owner parameter instead of name:
> {code:title=body.json|borderStyle=solid}
> {
>   "name":"totopf"
> }
> {code}
> {code:title=return.json|borderStyle=solid}
> {
>     "status": "failure",
>     "message": "A platform with the same name is already existing"
> }
> {code}
> Now, the request is accepted and my code is receiving a Platform object with null value
for owner....
> Expected behavior would be : 
> {code:title=body.json|borderStyle=solid}
> {
>   "name":"totopf"
> }
> {code}
> {code:title=return.json|borderStyle=solid}
> {
>     "status": "failure",
>     "message": "Owner must be provided."
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message