Skip to content

Commit

Permalink
Provide all fixed field names for the components object
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sergei-maertens committed Jan 3, 2024
1 parent 200b123 commit 22a7139
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drf_spectacular/plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,18 @@ def alpha_operation_sorter(endpoint):


class ResolvedComponent:
# 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'

def __init__(self, name, type, schema=None, object=None):
self.name = name
Expand Down

0 comments on commit 22a7139

Please sign in to comment.