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.

Default values missing in query

See original GitHub issue

First of all, thanks a lot for this package @cdimascio

I couldn’t find any other lib that handles OpenAPI v3 well, is well maintained and has a good amount of tests 😄

So here’s my issue: For example, I’m using this schema:

Sort:
      properties:
        field:
          default: id
          enum:
            - id
          type: string
        order:
          default: ASC
          enum:
            - ASC
            - DESC
          type: string
      type: object

Along with this query item:

parameters:
        - in: query
          name: sort
          required: false
          schema:
            $ref: '#/components/schemas/Sort'
          style: deepObject

Then, inside the route, the req.query.sort is an empty object instead of the default values, { sort: {field: 'id', order: 'ASC'} }

Is the not the desired behaviour or is it because of the deepObject style?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
xeoneuxcommented, May 7, 2020

Works perfectly fine! Thanks @cdimascio 😄

0reactions
cdimasciocommented, May 7, 2020

Yes. Its already available. Let me know how it goes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default value in a Query variable is missing - SAP Community
A variable screen with default Hierarchy value is being populated where user has an option to select a Hierarchy of his choice from...
Read more >
How to show missing rows with default values
This table has missing rows for a few months. I would like to query and show this data as well. So I created...
Read more >
Default Values missing for Report Parameters - MSDN
We started getting this error message when trying to run a report that relies on default parameter values based on queries: "The report...
Read more >
How to fill in missing rows in a table with default values in sqlite
For this query: select a.a, b.b, coalesce(c.c, 0) from (select distinct a from table) a cross join (select distinct b from table) b...
Read more >
How to replace null entries with default values in SQL
In SQL, we can use two functions to replace null entries with a default value. These functions are COALESCE() and ISNULL() . We'll...
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