swagger-api / swagger-api/swagger-parser

security requiements object is ignored when the components are in different file

Open
#940 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Description

my open api file is composed of two files.
openapi.yaml
and components.yaml
the paths in my openapi.yaml references the components files.

openapi-generator (javascript) ignores the security field unless I merged the two files
seems like the security field and the components (and their security schemes ) must be in the same file.

openapi-generator version

3.3.2

OpenAPI declaration file content or url

components.yaml

components:
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

openapi.yaml

security:
  - api_key: []

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

Reproduce the issue using the split openapi.yaml and components.yaml examples, with the security scheme defined in components.yaml and the security requirement in openapi.yaml. Start by tracing how the parser resolves referenced components and security schemes across files. Done means the JavaScript generator honors the security requirement without merging the files.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.