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

Provide all fixed field names for the components object in ResolvedComponent.* constants #1138

Merged

Conversation

sergei-maertens
Copy link
Contributor

Closes #1128

The OpenAPI components object (https://swagger.io/specification/\#components-object) is used to store schema definitions that can be referred to using the
pattern, encouraging re-use. drf-spectacular only uses the
'schemas' and 'securitySchemes' properties internally, but extension developers may wish to use the remaining properties, so they are provided as a convenience.

Note that the 'pathItems' property was added in OpenAPI 3.1.0.

The OpenAPI components object (https://swagger.io/specification/\#components-object)
is used to store schema definitions that can be referred to using the
 pattern, encouraging re-use. drf-spectacular only uses the
'schemas' and 'securitySchemes' properties internally, but extension
developers may wish to use the remaining properties, so they are
provided as a convenience.

Note that the 'pathItems' property was added in OpenAPI 3.1.0.
Comment on lines +683 to +694
# OpenAPI 3.0.3
SCHEMA = 'schemas'
RESPONSE = 'responses'
PARAMETER = 'parameters'
EXAMPLE = 'examples'
REQUEST_BODY = 'requestBodies'
HEADER = 'headers'
SECURITY_SCHEMA = 'securitySchemes'
LINK = 'links'
CALLBACK = 'callbacks'
# OpenAPI 3.1.0+
PATH_ITEM = 'pathItems'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added & documented them in the same order as the OpenAPI spec does.

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (200b123) 98.63% compared to head (22a7139) 98.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1138   +/-   ##
=======================================
  Coverage   98.63%   98.63%           
=======================================
  Files          71       71           
  Lines        8690     8698    +8     
=======================================
+ Hits         8571     8579    +8     
  Misses        119      119           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tfranzel tfranzel merged commit c53b677 into tfranzel:master Jan 3, 2024
35 checks passed
@tfranzel
Copy link
Owner

tfranzel commented Jan 3, 2024

awesome, thanks @sergei-maertens

I think I'll add some comment later that we only use 2 natively. People kept asking about the others on occasion.

@Viicos Viicos deleted the feature/1128-additional-type-constants branch January 3, 2024 15:12
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.

Add additional type constants for plumbing.ResolvedComponent
2 participants