Skip to content

Preserve security definitions in bundled OpenAPI output#507

Merged
Vibaswan merged 3 commits into
mainfrom
consider_security_definations
May 7, 2026
Merged

Preserve security definitions in bundled OpenAPI output#507
Vibaswan merged 3 commits into
mainfrom
consider_security_definations

Conversation

@Vibaswan

@Vibaswan Vibaswan commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The bundler was silently dropping the root-level security field and components.securitySchemes when bundling multi-file OpenAPI specs. This PR fixes that.
  • Added "security" to the list of top-level keys copied from source YAML files in _process_yaml_object.
  • Initialized securitySchemes: {} in the default components structure and added name validation for security schemes, consistent with how schemas and responses are handled.
  • Fixed a crash in _check_nested_components when a components block contains only securitySchemes and no schemas key.

Test plan

  • Added openapiart/tests/security/security.yaml — a fixture covering bearer, API key, OAuth2, and OpenID Connect schemes, plus root-level and operation-level security overrides.
  • Added openapiart/tests/test_security_definitions.py — verifies that after bundling, the output YAML contains the correct root security list, all four securitySchemes entries with their full structure, and per-operation security overrides (/status with OAuth2 scope, /public with empty list).

Note: no validation for the security schemas has been added

@Vibaswan Vibaswan self-assigned this May 5, 2026
@lthompson-keysight

Copy link
Copy Markdown

LGTM

@lthompson-keysight lthompson-keysight left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Vibaswan Vibaswan merged commit 04db70f into main May 7, 2026
26 of 28 checks passed
@Vibaswan Vibaswan deleted the consider_security_definations branch May 7, 2026 06:46
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 this pull request may close these issues.

2 participants