swagger-api/swagger-ui

ExampleObject annotation is not working

Open

#6363 aperta il 7 set 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)JavaScript (8801 fork)batch import
Hacktoberfesttype: enhancement

Metriche repository

Star
 (25.447 star)
Metriche merge PR
 (Merge medio 20h 34m) (14 PR mergiate in 30 g)

Descrizione

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

Guida contributor