Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

'code' parameter in ApiOperation ignored for POST requests #108

Closed
ghost opened this issue Aug 31, 2018 · 2 comments
Closed

'code' parameter in ApiOperation ignored for POST requests #108

ghost opened this issue Aug 31, 2018 · 2 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Aug 31, 2018

Just noticed that this is an issue in version 1.0.4. It works as expected if a I roll back to 0.1.9.

I have a number of APIs that are annotated like this:

@POST
@ApiOperation(value = 'Create foo',
    notes = 'Creates a foo.',
    nickname = 'createFoo',
    response = FooModel,
    code = 201)

In 0.1.9, the response object in generated swagger.json looks like this, as expected:

"responses" : {
    "201" : {
    "description" : "successful operation",
    "schema" : {
    "$ref" : "#/definitions/FooModel"
    }
  }
}

In 1.0.4, it looks like this:

"responses" : {
   "200" : {
   "description" : "successful operation",
   "schema" : {
   "$ref" : "#/definitions/FooModel"
   }
 }
}

So it seems that code=201 in the @ApiOperation annotation is being ignored.

@gigaSproule
Copy link
Owner

gigaSproule commented Nov 8, 2018

I will add a test for this, see what happens. Is expect it to pick it up perfectly fine, but clearly not.

The test related to TestResourceWithClassAnnotation will readily site it up.

@gigaSproule
Copy link
Owner

So turns out that with Spring, this worked fine (as the reader picked read the value), whereas JAX-RS reader was missing a line, so wasn't reading the value. I've pushed the fix, so will be fixed in the next release.

gigaSproule added a commit that referenced this issue Nov 10, 2018
…-not-being-picked-up

Fixed issue #108 where HTTP status code was not being picked up in JA…
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant