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.

Option to strip out unused parameters

See original GitHub issue

This may already be included somewhere, but it would be awesome if there was an option to strip out parameters that aren’t in the docs. For example:

If a query parameter age is defined, but ?age=30&foo=bar is passed, I would like req.query to only contain age.

I’m not sure which underlying express-openapi-* module would contain this, or perhaps it would be a new one.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
buzzwarecommented, Feb 13, 2020

The ajv option “removeAdditional: true” does this when the schema has “additionalProperties: false”. There are other options for removeAdditional

1reaction
dkMorlokcommented, Feb 17, 2021

I’m dealing with same/similar problem, need to remove additional data without throwing errors.

  • when i set "additionalProperties: false" into schema validator throw errors
  • when i add to Ajv config removeAdditional: true it removes additional data and not throws errors

Very helpful is this test https://github.com/ajv-validator/ajv/blob/ba752505cf53a136eda1c4f4b81bf9e697a42dc2/spec/options/removeAdditional.spec.ts#L27

Would be nice to have ajv options configurable for openapi-request-validator, or at least just this one removeAdditional. (using only component openapi-request-validator)

UPDATE: i want to remove additional data from body.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the best way to suppress A "Unused variable x" ...
In GCC and Clang, add -Wno-unused-parameter option at the end of the command line (after all options that switch unused parameter warning on ......
Read more >
IDE0060: Remove unused parameter - .NET
The option value specifies if unused parameters should be flagged only for non-public methods or for both public and non-public methods. For ...
Read more >
C# - IDE0060: Remove unused parameter
Option 2 – Remove the parameter · Right-click the method name. · Click Quick Actions and Refactorings… · Click Change signature… · Select...
Read more >
Unused parameters in C and C++
This macro does two things: first, it abstracts the definition of the attribute so that configure may strip it out if the attribute...
Read more >
Autoflake — Remove Unused Imports & Unused Variables ...
To remove unused variables, use the --remove-unused-variables option. Below is the full listing of options: usage: autoflake [-h] [-i] [-r] ...
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