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

Example property on operations does not work #2767

Closed
dilipkrish opened this issue Nov 7, 2018 · 14 comments
Closed

Example property on operations does not work #2767

dilipkrish opened this issue Nov 7, 2018 · 14 comments
Labels
Milestone

Comments

@dilipkrish
Copy link
Member

@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Not Found",
                examples = @Example(
                        value = {
                                @ExampleProperty(
                                        mediaType = "Example json",
                                        value = "{\"invalidField\": \"address\"}"),
                                @ExampleProperty(
                                        mediaType = "Example string",
                                        value = "The first name was invalid")}),
response = Response.class)})

and the fields in Response class are annotated with @ApiModelProperty(required = true, example = "Timeout exceeded") then the example is also rendered. It's kind of a workaround, but also not an option in my case, because I need to use class provided by library and I can't annotate it.

Originally posted by @tgielbutowicz in #2352 (comment)

@prisin
Copy link

prisin commented Jan 17, 2019

Examples are not getting reflected in @ApiResponses. I am using springfox 2.9.2. Any idea when this will be fixed ?

@sboursault
Copy link

Same behaviour with 3.0.0-SNAPSHOT :(

@lcl1992421
Copy link

Any update of this?

@prabhushrikant
Copy link

prabhushrikant commented Jul 9, 2020

I am still facing problem with this, @example is not rendered even with 3.0.0-SNAPSHOT when it's just a week before it's getting released.

@prabhushrikant
Copy link

I am still facing problem with this, @example is not rendered even with 3.0.0-SNAPSHOT when it's just a week before it's getting released.

I see it's fixed in 311aa95 when will it be available in SNAPSHOT?

@dilipkrish
Copy link
Member Author

Yes it should be, would love to see your feedback

@prabhushrikant
Copy link

Yes it should be, would love to see your feedback

Looks like issue is not yet solved. Something to note though, even when I reimported my dependencies but it's still showing old value for jar - springfox-oas-3.0.0-SNAPSHOT.jar, it should be a newer value correct?

Manifest-Version: 1.0
Implementation-Title: springfox-oas
Implementation-Version: 3.0.0-SNAPSHOT
Created-By: 11.0.2 (Oracle Corporation)
Built-With: gradle-6.5, groovy-2.5.11
Build-Time: 2020-07-08T11:13:48+0000
Built-By: circleci
Built-On: 82201b430220/192.168.16.3

@dilipkrish
Copy link
Member Author

You need to force update your snapshot.

@prabhushrikant
Copy link

prabhushrikant commented Jul 9, 2020

We have lost the regular schema functionality though , other error codes expect @example also even though it can be easily inferred from its models
e.g. it's now coming as follows :
image

but before this update it used come out like this .

image

@prabhushrikant
Copy link

prabhushrikant commented Jul 9, 2020

You need to force update your snapshot.

Thanks, I confirm after refreshing snapshot libraries @example annotation started working (check screenshot below) but it doesn't show schema object (as it shows in request body) in following screen shot

image

@dilipkrish
Copy link
Member Author

Could you try using OAS-30 in your Docket?

@prabhushrikant
Copy link

Could you try using OAS-30 in your Docket?

Yes I am using OAS-30 in my docket. @example annotation doesn’t work otherwise

@dilipkrish
Copy link
Member Author

You clearly aren't using these 3.0 annotations

@prabhushrikant
Copy link

prabhushrikant commented Jul 13, 2020

what are the plans for releasing 3.0.0-SNAPSHOT into a official release? Where can I track if it's released?

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

No branches or pull requests

5 participants