Skip to content

Conversation

@agogs
Copy link

@agogs agogs commented Jul 20, 2017

Parse @example nested inside @apiresponse annotation

@agogs agogs changed the title issue-2319 parse Example from APiResponse annotations #2319 parse Example from APiResponse annotations Jul 21, 2017
@agogs agogs changed the title #2319 parse Example from APiResponse annotations #2319 parse @Example from @APiResponse annotations Jul 21, 2017
@frantuma frantuma changed the base branch from master to 1.5 April 30, 2018 15:31
Copy link
Contributor

@frantuma frantuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along inline comments, we would also need to add some related tests. This would indeed introduce example support to response annotation, limited to String types, therefore not fully solving #2319, but probably better than no support. Let me know if you can update PR, and/or any comment.

Also related to #1107 and linked tickets, a full solution
would be similar to the one applied in 2.0 version, probably in scope of #1107 and related.


Response response = new Response()
.description(apiResponse.message()).headers(responseHeaders);
.description(apiResponse.message()).headers(responseHeaders).setExamples(examples);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would call response.setExamples() on new line, with no need of modifying setter behaviour in response POJO

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will change that.

public void setExamples(Map<String, Object> examples) {
public Response setExamples(Map<String, Object> examples) {
this.examples = examples;
return this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want to modify setter behaviour, see also comment above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@agogs
Copy link
Author

agogs commented May 9, 2018

There is already an unit test for this feature at swagger-core\modules\swagger-core\src\test\java\io\swagger\ResponseExamplesTest.java

@frantuma
Copy link
Contributor

frantuma commented May 9, 2018

included and replaced by #2801

@frantuma frantuma closed this May 9, 2018
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

Successfully merging this pull request may close these issues.

2 participants