rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

Use "example" field of schemas #11

Closed birdayz closed 5 years ago

birdayz commented 5 years ago

Each schema (e.g. for a response or request) can have a field "example". This field is currently not used to display the example.

You can see this with our API doc: https://infinimesh.github.io/infinimesh/swagger-ui/openapi.yaml

POST to /namespaces/{namespace}/objects/{parent}/children has an example, it's shown in swagger-ui but not in rapidoc.

mrin9 commented 5 years ago

I am sorry, I could not find the endpoint you mentioned in the spec. Not even in swagger-ui.

can you try this spec from Microsoft Azzure https://api.apis.guru/v2/specs/azure.com/workloadmonitor-Microsoft.WorkloadMonitor/2018-08-31-preview/swagger.json

This has a lots of examples in the response schema, and RapiDoc is showing the examples

birdayz commented 5 years ago

Yeah bad timing, i removed the examples just right now in a refactoring :(

here from history: https://raw.githubusercontent.com/infinimesh/infinimesh/d0c5127a908b6471e44da1a233d93d418dceb904/docs/swagger-ui/openapi.yaml

infinimeshapiCreateObjectRequest:
  example:
    name: name of child

That example is not shown in rapidoc if im not wrong

mrin9 commented 5 years ago

ok, I see the difference. RapiDoc, uses example from each field (if provided) to generate the JSON structure that matches the model. But ignores the example provided for the entire response. Let me think over it a little on this

Thanks for reporting

mrin9 commented 5 years ago

this should be fixed in release 4.2.4