Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The parameter values for the function handling the REST API doesn't reads the value for required parameter. #53

Open
subodh-dharma opened this issue Mar 19, 2018 · 0 comments

Comments

@subodh-dharma
Copy link

The function definition for the function with swagger annotations is as follows:

public Response getTopErrors(@Context HttpServletRequest request, @Context UriInfo urlInfo,
			@ApiParam(value = "ID of the tenant to filter by", required = true) @QueryParam("tenantId") String tenantId,
			@ApiParam(value = "Name of the service to filter by", required = true) @QueryParam("serviceName") String serviceName, 
			@ApiParam(value = "ID of the component to filter by", required = false) @QueryParam("componentId") String componentId,
			@ApiParam(value = "Start timestamp for the lookup time window", required = true) @QueryParam("monitorBeginTime") String monitorBeginTime,
			@ApiParam(value = "End timestamp for the lookup time window", required = true) @QueryParam("monitorEndTime") String monitorEndTime,
			@ApiParam(value = "The number of top errors to return", required = true) @QueryParam("topCount") int topCount) {

Each of the above @QueryParam has a field required = true | false . The swagger.json generated doesn't takes the field into consideration. In the above function definition the 3rd parameter componentId has the field value for required = false but the swagger.json has the value set to true.

Following is the swagger.json:

"/api/v1/app_metrics/errors/toperrors":{
            "get":{
                "consumes":[
                ],
                "produces":[
                    "application/json"
                ],
                "parameters":[
                    {
                        "type":"string",
                        "name":"componentId",
                        "in":"query",
                        "required":true
                    },
                    {
                        "type":"string",
                        "name":"monitorBeginTime",
                        "in":"query",
                        "required":true
                    },
                    {
                        "type":"string",
                        "name":"monitorEndTime",
                        "in":"query",
                        "required":true
                    },
                    {
                        "type":"string",
                        "name":"serviceName",
                        "in":"query",
                        "required":true
                    },
                    {
                        "type":"string",
                        "name":"tenantId",
                        "in":"query",
                        "required":true
                    },
                    {
                        "type":"integer",
                        "name":"topCount",
                        "in":"query",
                        "required":true
                    }
                ],
                "responses":{
                    "200":{
                        "description":"OK",
                        "headers":{
                        },
                        "schema":{
                            "type":"string"
                        }
                    }
                }
            }
        },

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant