Swagger UI for REST Request body example

3,432 views
Skip to first unread message

Provash Dowari

unread,
Oct 13, 2017, 9:42:29 AM10/13/17
to Swagger
Hi,

I have query for example request body rendering in Swagger UI. I am using swagger-jaxrs2-2.0.0-rc2 version for document json generation and swagger-ui-v3.3.1 for UI. Below is my sample code for REST Resource.

Sample Code :
test(@RequestBody(required = true, content = @Content(mediaType = APPLICATION_JSON,schema = @Schema(implementation = Foo.class, example ="fooex1" )
,examples ={@ExampleObject(name="fooExternalEx1",externalValue="http://localhost:8080/receiver/fooExternalEx1.json")})) Foo f) {
}

As per Open API spec documentation, UI should replace schema example  with Content example. But UI does not rendering external example. I have seen generated openapi.json has reference to external example.

openapi.json snippet:
"requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/Foo"
              },
              "examples" : {
                "fooExternalEx1" : {
"description" : "fooExternalEx1",
"externalValue" : "http://localhost:8080/receiver/fooExternalEx1.json"
} } } }, "required" : true },

Please let me know what could be the issue or Do I have to do any other configuration.


Regards,
Provash

Ron Ratovsky

unread,
Oct 13, 2017, 12:47:29 PM10/13/17
to swagger-sw...@googlegroups.com

It’s not implemented in the UI yet. You can file a ticket with the project.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sharad Goyal

unread,
Oct 19, 2018, 11:19:16 AM10/19/18
to Swagger
Do you know when it will be implemented?
Reply all
Reply to author
Forward
0 new messages