Sourabh
Sourabh

Reputation: 119

Swagger setting path parameter data type

I am trying to set the path parameter as below

@PUT
    @Path("{myParam}/myEndpoint")
    @ApiOperation(value = SwaggerApiConst.EVENT)
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @ApiImplicitParams({
        @ApiImplicitParam(dataType = "long", name = "myParam", paramType = "path")
       })
    public Response group( @PathParam("myParam") Long myParam, SomeObj someObj) {

Trying to set the data type of parentAlarm as long, but it appears as integer in the swagger.json file.

'/myApi/{myParam}/myEndpoint':
    put:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - type: integer
          name: myEndpoint
          in: path
          required: true
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/SomeObj'

swagger version used is

<swagger.version>1.5.0</swagger.version>

@ApiImplicitParam seems to have no effect here. Is there an alternative ?

Upvotes: 1

Views: 1234

Answers (1)

D George
D George

Reputation: 188

Swagger supports only integer and number datatypes. Long is specified as int64 and integer as int32. You can read more about the data types here - https://swagger.io/docs/specification/data-models/data-types/

Upvotes: 1

Related Questions