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.

Clarify `allowEmptyValue`

See original GitHub issue

From the specification it is a little ambiguous what the allowEmptyValue entails, notably what empty means:

  • is a string containing only whitespaces considered empty?
  • does it only affect a query parameter when its value is of type: string? Or would 0, false, [] or {} qualify as empty when a query parameter is of another type?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
webroncommented, May 9, 2018

So here’s the clarification, and we can add more information in the spec if needed.

allowEmptyValue means a zero-length value can be provided. This translates to ?exampleParam= and not ?exampleParam. There is no way to describe ?exampleParam, and from what I recall in our discussions on this topic, many @OAI/tsc members claimed that such a thing doesn’t really exist.

Combining allowEmptyValue with minLength=10 is meaningless as given you are defining a minimum length, 0 isn’t it. Only the minLength will actually take effect here.

As for the follow-up question: yes, a required parameter can allow empty values, there’s no contradiction there.

1reaction
MikeRalphsoncommented, May 14, 2018

@darrelmiller although these relate to OAS 2.0 - two (and only two) Microsoft Azure API definitions specifiy allowEmptyValue: true. These are:

  • applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/favorites_API
  • trafficmanager/resource-manager/Microsoft.Network/preview/2017-09-01-preview/trafficmanageranalytics

Perhaps reaching out to find the intent of using the flag in these cases might be an interesting data point?

Only two other API definitions across the whole of APIs.guru (1,400+ definitions) use allowEmptyValue so it certainly does not seem to be widely adopted in public APIs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Correcting Springfox setting allowEmptyValue on path ...
The issue is that the swagger document generated by springfox (2.9.2) has a "allowEmptyValue":false which is disallowed on a path parameter ...
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false . allowEmptyValue, boolean, Sets the ...
Read more >
allowEmptyValue - not sending 'null' on update?
I'm getting the string null, when it should be empty. Isomorphic, we are not seeing the behavior that you are describing in our...
Read more >
Required, empty fields are mistakenly validated as missing but ...
This PR adds support for allowEmptyValues for String params, ... params that clarifies that the param has been supplied with an empty string....
Read more >
medSRS - medical Standard Routing Service
... "required": true, "allowEmptyValue": false, "style": "form", "explode": true, ... It also clarifies whether the standard used is supported by the ...
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