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.

Wrong model titles when composing using allOf

See original GitHub issue

When composing models using allOf, swagger-ui displays wrong model title for composed model. It uses last model referenced in allOf instead of one defined.

Definition:

definitions:
  Simple1:
    type: object
    properties:
      id1:
        type: integer
        format: int64
  Simple2:
    type: object
    properties:
      id2:
        type: integer
        format: int64
  Composed:
    allOf:
      - $ref: '#/definitions/Simple1'
      - $ref: '#/definitions/Simple2'

Expected result:

Simple1{...}
Simple2{...}
Composed{...}

Actual result:

Simple1{...}
Simple2{...}
Simple2{...}

Affected version: v3.0.0-229-g7790383

Ghist with full issue demonstration

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
Xuanwocommented, Jun 15, 2017

I have encountered the same problem, how is the progress?

0reactions
florent-pasquer-needonecommented, Oct 18, 2017

Tip : add composition value with the model title :

- $ref: ‘#/definitions/Simple1’ - $ref: ‘#/definitions/Simple2’

=>

- $ref: ‘#/definitions/Simple1’ - $ref: ‘#/definitions/Simple2’ - title: “Composed”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Open API generator allOf not generating model correctly
I want to generate our models based on an Openapi spec 3.0 yml definition. In my spec I have a definition using allOf...
Read more >
Inheritance and Polymorphism - Swagger
Model Composition. In your API, you may have model schemas that share common properties. ... In OpenAPI version 3, you do this with...
Read more >
Understanding JSON Schema 2020-12 documentation
JSON Schema includes a few keywords for combining schemas together. Note that this doesn't necessarily mean combining schemas from multiple files or JSON ......
Read more >
How to write Swagger documentation for Laravel API. Tips ...
Let's create a User object. I prefer adding that in Model class. /** * * @OA\Schema( * required={"password"},
Read more >
Strict Type Validation With Pydantic - Section.io
Objects in Pydantic are defined using models. A model class inherits from the BaseModel class. All of the fields and custom validation logic ......
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