You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/02/13 13:59:41 UTC
[jira] [Resolved] (CAMEL-10821) Camel-swagger-java doesn't parse
multiple required parameters
[ https://issues.apache.org/jira/browse/CAMEL-10821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-10821.
---------------------------------
Resolution: Not A Problem
Assignee: Claus Ibsen
> 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)