2018-04-17 12:18:40 +00:00
|
|
|
"""OpenAPI core paths models module"""
|
|
|
|
|
|
|
|
|
|
|
|
class Path(object):
|
|
|
|
"""Represents an OpenAPI Path."""
|
|
|
|
|
2020-02-07 11:21:11 +00:00
|
|
|
def __init__(
|
|
|
|
self, name, operations,
|
|
|
|
summary=None, description=None, parameters=None, servers=None,
|
2020-03-03 13:01:45 +00:00
|
|
|
extensions=None,
|
2020-02-07 11:21:11 +00:00
|
|
|
):
|
2018-04-17 12:18:40 +00:00
|
|
|
self.name = name
|
|
|
|
self.operations = dict(operations)
|
2020-02-07 11:21:11 +00:00
|
|
|
self.summary = summary
|
|
|
|
self.description = description
|
|
|
|
self.servers = servers
|
2019-03-08 09:19:09 +00:00
|
|
|
self.parameters = dict(parameters) if parameters else {}
|
2018-04-17 12:18:40 +00:00
|
|
|
|
2020-03-03 13:01:45 +00:00
|
|
|
self.extensions = extensions and dict(extensions) or {}
|
|
|
|
|
2018-04-17 12:18:40 +00:00
|
|
|
def __getitem__(self, http_method):
|
|
|
|
return self.operations[http_method]
|