Skip to content
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

Duplicate error reason for request parameter when it is required #452

Closed
NickUfer opened this issue Nov 28, 2021 · 0 comments · Fixed by #453
Closed

Duplicate error reason for request parameter when it is required #452

NickUfer opened this issue Nov 28, 2021 · 0 comments · Fixed by #453

Comments

@NickUfer
Copy link
Contributor

When I define a request parameter which is required I get the message value is required but missing twice when I call openapi3filter.RequestError.Error().

Schema:

#...
parameters:
  - name: 'hostname'
    in: query
    description: '...'
    schema:
      type: string
    required: true
#...

Code for validation:

if err := openapi3filter.ValidateRequest(c.Request.Context(), requestValidationInput); err != nil {
	c.String(400, err.Error())
	c.Abort()
	return
}

Message when the parameter is missing:
parameter "hostname" in query has an error: value is required but missing: value is required but missing

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

Successfully merging a pull request may close this issue.

1 participant