question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Response example not rendering

See original GitHub issue

Response example not rendering

Response object is not rendering when configured as sister of schema and deletes properties when configured as daughter of schema

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 3.X
Which Swagger-UI version? 3.4.0
How did you install Swagger-UI? github
Which browser & version? Chrome 62
Which operating system? Ubuntu 64

According to the docs, example should be a sister to schema when using $ref. When doing this, I do not get the substitution I would expect for count, next, and previous

      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Response'
                  - type: object
                    properties:
                      results:
                        type: array
                        items:
                            type: object
                            $ref: '#/components/schemas/Detection'
              example:
                count: 10
                next: "http://127.0.0.1/api/v2/detection?page=3&page_size=1"
                previous: "http://127.0.0.1/api/v2/detection?page=1&page_size=1"

substitution1

When I move example to a daughter of schema, I get he substitution, but lose additional properties that were appended to the schema

      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Response'
                  - type: object
                    properties:
                      results:
                        type: array
                        items:
                            type: object
                            $ref: '#/components/schemas/Detection'
                example:
                  count: 10
                  next: "http://127.0.0.1/api/v2/detection?page=3&page_size=1"
                  previous: "http://127.0.0.1/api/v2/detection?page=1&page_size=1"

substitution2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hkosovacommented, Aug 13, 2018

@keenle support for OAS3 media type examples is being tracked in #2651.

0reactions
shockeycommented, Aug 28, 2018

Closing as a duplicate of #2651

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express - Do not render POST response - Stack Overflow
I have a basic Express API: app.get('/example', ...
Read more >
Suspense for Data Fetching (Experimental) - React
Approach 1: Fetch-on-Render (not using Suspense) ... they can render. In this example, two components wait for an asynchronous API call to fetch...
Read more >
DataTable Not Rendering Rows Even Though JSON ...
I'm implementing a DataTable that makes an AJAX call. Per the Chrome browser F12 console, it's receiving the correct JSON response but not...
Read more >
Renderers - Django REST framework
Renders data to HTML, using Django's standard template rendering. Unlike other renderers, the data passed to the Response does not need to be...
Read more >
API Reference - Express 4.x
toString() may fail in multiple ways, for example foo may not be there or may not be a ... When a file is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found