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.

No validation for custom headers

See original GitHub issue

Hi,

I have defined in my open api spec required headers for an endpoint and although not received, the validator doesn’t reject the request and performs no validation.

example of the open-api spec:

 get:
      responses:
        '200':
          description: A JSON array of objects
      parameters:
        - name: x-userId
          in: header
          schema:
            type: string
            maxLength: 255
          required: true

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cdimasciocommented, Feb 16, 2020

Excellent. Glad you sorted it out. Please let me know if the documentation needs updating to make this clear. Thanks @stanleynguyen

0reactions
daward-redhat-comcommented, Oct 13, 2022

Hi. I am running into the exact same issue in Java/SpringBoot. My version of openapi-generator-maven-plugin is 4.3.1. (I don’t think it’s relevant, by my version of springdoc-openapi-ui is 1.6.0.) When I switch from in: query to in: header, these annotations disappear from the generated api class: @NotNull @Size(min=5,max=10) @Valid Any ideas? Do you have any examples written in Java?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I use model validation to validate HTTP headers in .Net ...
I think there is no default validation method for custom headers in asp.net core, you need to implement it by custom methods.
Read more >
enforcing custom headers - MSDN - Microsoft
I know we can validate if the custom header entry and value exist but I am curious if a way exists to have...
Read more >
CSRF protection with custom headers (and without validating ...
The first method involves setting custom headers for each REST request such as X-XSRF-Header. The value of this header does not matter; simply ......
Read more >
Pass custom headers through API Gateway to a Lambda ...
I want to configure an AWS Lambda function through custom (non-proxy) integration to process custom headers that are passed through my ...
Read more >
How to Add Custom Headers in ASP.NET Core Web API
If we want a clean and reusable method for adding the same custom header to multiple Web API endpoints, or even at 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