OpenAPITools / OpenAPITools/openapi-generator

[BUG] Authorization Header; Case is not respected

Open
#6,768 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug Server: Nodejs
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used? Latest Master
  • Have you search for related issues/PRs? Yes
  • What's the actual output vs expected output? Header is accepted with a capitilsation
  • [Optional] Bounty to sponsor the fix (example)
Description

An OAuth 2.0 Access Token is conveyed in a header called Authorization. This can be defined for example like below.
- description: 'An Authorisation Token as per https://tools.ietf.org/html/rfc6750'
explode: false
in: header
name: Authorization
required: true
schema:
type: string
style: simple

Unfortunately the capitalization requirements of the Authorization header isn't being respected by the generator

{
"error": [
{
"path": ".headers.authorization",
"message": "should have required property 'authorization'",
"errorCode": "required.openapi.validation"
}
]
}

So a request with Authorization results in an error being thrown.

openapi-generator version

Latest, it is not a regression.

OpenAPI declaration file content or url
        - description: 'An Authorisation Token as per https://tools.ietf.org/html/rfc6750'
          explode: false
          in: header
          name: Authorization
          required: true
          schema:
            type: string
          style: simple
Command line used for generation

openapi-generator generate -g nodejs-express-server -i account-info-openapi.yaml

Steps to reproduce

Generate the server, launch server, send a request with an Authorization header with a capital A.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the nodejs-express-server generator and the generated request validation path described by the reproduction. Generate from the supplied OpenAPI header definition, send Authorization with a capital A, and consider the issue done when the request is accepted without the lowercase-name required-property error.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, java, nodejs, openapi
Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.