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.

Cannot properly rendering responses -> schema -> allOf

See original GitHub issue

I have to handle pagination across all GET API’s The common signature is

{
    offset: number,
    limit: number,
    total: number,
   result: [
   ]
}

However “result” contains for each GET different inner object(s) (User, UserProfile, Application, Group, etc.) So, here is sample of two definitions:

definitions:
  PaginationHeader:
    type: object
    properties:
      offset:
        type: number
      limit:
        type: number
      total:
        type: number
  User:
    type: object
    properties:
      id:
        type: number
      name:
        type: string
      active:
        type: boolean

Now in each response I am trying combine PaginationHeader + result Object
      responses:
        "200":
          description: Success
          schema:
            allOf:
              - $ref: '#/definitions/PaginationHeader'
              - properties:
                  result:
                    type: array
                    items:
                      $ref: '#/definitions/User'

No Errors. But in editor I can see undefined, and I can expand result but not RaginationHeader

image

And UI just empty object image

Whats wrong and how can I fix it?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Maxooocommented, Dec 2, 2016

Hi, Is there anything new on this behavior (a reference to a new ticket for example) ? This problem seems to be still relevant.

Thank you.

0reactions
fehguycommented, Jun 5, 2016

OK that’s swagger-editor, which does not use this library. I suggest you open an issue in that project. For swagger-ui, we get what is expected:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

allOf in $ref schema doesn't render properly #2765 - GitHub
if $ref schema has allOf in it final schema is not rendered correctly. UI shows empty object and renders as string.
Read more >
jsonschema - JSON schema allOf - Stack Overflow
I have tried many different variations of structure but none have validated successfully. The input JSON, which should be invalid (but showing ......
Read more >
Schema name no longer appears correctly when referenced ...
Schema name no longer appears correctly when referenced in allOf + oneOf - it just shows as the name of the model all...
Read more >
OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model ...
Read more >
oneOf, anyOf, allOf, not - Swagger
Now, to validation. The following JSON object is valid against one of the schemas, so the response body is correct: { ...
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