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.

[Question] Extend/override properties of a parameter

See original GitHub issue

Hello there, I got a small question about the compoments[parameter]

Currently, im trying to make some parameters reusable and the basic seems pretty simple.

# 
openapi: 3.0.1
info:
  title: An include file to define common parameters
  version: 1.0.0
paths: 
    /test:
      get:
        ...
        parameters:
          - $ref: 'parameters.yml#/components/parameters/reusableParam'
        ...
components:
  parameters:
    reusableParam:
      in: query
      name: reusableParam
      description: filter something
      schema:
        type: number
        default: 30

Now my question is, how can I avoid to duplicate the reusableParam if another path might need the same one but maybe with required: true or different default: 50

what would be the “correct” way to do it?

Thank you in advance.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:78
  • Comments:26 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
bilakcommented, Apr 14, 2020

This would be very helpful. I’m also defining parameters which differ only with required attribute (true |false).

8reactions
tmtroncommented, Dec 13, 2021

We’d also like to override example/examples. We often have endpoints that return the same object, but the examples should be different

see also: https://github.com/nestjs/swagger/issues/1723

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to override the "required" attribute of a referenced ...
As of OpenAPI 3.1, you can only override the description of a referenced parameter, but not other attributes ( required , name and...
Read more >
Overloading vs. Overriding - Educative.io
Overriding occurs when two methods have the same method name and parameters. One of the methods is in the parent class, and the...
Read more >
Object orientation - The Apache Groovy programming language
When the first argument is a Map, Groovy combines all named parameters into a Map (regardless of ordering) and supplies the map as...
Read more >
Initialization — The Swift Programming Language (Swift 5.7)
The structure defines a single initializer, init , with no parameters, ... property rather than a variable property for the text property of...
Read more >
Overriding in Java - GeeksforGeeks
Overriding and Access-Modifiers : The access modifier for an overriding method can allow more, but not less, access than the overridden method.
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