swagger-api / swagger-api/swagger-ui

ExampleObject annotation is not working

Open
#6,363 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Hacktoberfest type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

I have the following annotation setup:

@RequestBody(description = "Send in your requestor id to subscribe", required = true, content = {
        @Content(mediaType = MediaType.APPLICATION_XML,
                examples = {
                        @ExampleObject(summary = "1", name = "2", value = "3", externalValue = "4", ref = "5",
                                extensions = @Extension(name = "6",
                                        properties = @ExtensionProperty(name = "7", value = "8", parseValue = true)))
                        , @ExampleObject(summary = "a1", name = "a2", value = "a3", externalValue = "a4", ref = "a5",
                        extensions = @Extension(name = "a6",
                                properties = @ExtensionProperty(name = "a7", value = "a8", parseValue = false)))

                }
        )
})

And would expect the example to be present in the swagger-ui but I have this:

image

What did work was the description and the required of the @RequestBody and the mediaType. from the @Content

I use this package: io.swagger.v3.oas.annotations.parameters from swagger annotation 2.0.8 and also not working with the latest at the moment: 2.1.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Java annotation setup in Swagger UI using the reported annotation versions, then compare the displayed result with the expected examples. No source file or test is named; done means both ExampleObject entries and their properties appear in the Swagger UI as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
documentation, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.