Skip to content

allowEmptyValue flag is ignored #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlekseyMko opened this issue Dec 18, 2019 · 4 comments
Closed

allowEmptyValue flag is ignored #190

AlekseyMko opened this issue Dec 18, 2019 · 4 comments

Comments

@AlekseyMko
Copy link

AlekseyMko commented Dec 18, 2019

Hello, looks like allowEmptyValue flag is not validated

yuml snippet:

paths:
  /storyInfo:
    get:
      tags:
        - userId
      summary: Detailed information about story
      operationId: storyInfo
      parameters:
        - name: storyId
          in: query
          required: true
          schema:
            type: string
          allowEmptyValue: false

request url:
/api/storyInfo?storyId or /api/storyInfo?storyId=

AR: Validator accepted the query, the handler was called
ER Validator should throw an error

@cdimascio
Copy link
Owner

@AlekseyMko thanks for the issue. this certainly needs to be added
Are you interested in taking a crack at? it believe this requires we add custom ajv keyword.
if interested, let's chat on gitter

@cdimascio
Copy link
Owner

FYI: OpenAPI spec describes this as not recommended and likely to be removed.

allowEmptyValue | boolean | Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.

@cdimascio
Copy link
Owner

openapi notes that The default should be false, which is not honored by the validator. will look into it

@cdimascio
Copy link
Owner

@AlekseyMko this is fixed in v3.5.0.
fyi @ctiaffay-conserto

cdimascio pushed a commit that referenced this issue Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants