forked from Dorthu/openapi3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hey William! I really love your openapi3 package! I have done a couple of changes to it according to your roadmap and would like to ask you to review please? Do you think it would be possible to commit them and release a 0.0.2 on pypi.org? I am attaching all my changes to this mail. git-am(1) can apply them to the repository. Thank you so much! Matthias PS: I am on freenode (nick: mweckbecker) in #linode should you want to discuss anything regarding openapi3. I'm happy to contribute much more. From de617f3ef308710449c8b26f9146903fe9699411 Mon Sep 17 00:00:00 2001 From: Matthias Weckbecker <[email protected]> Date: Wed, 5 Jun 2019 09:34:24 +0200 Subject: [PATCH 01/10] Make code pep8 compliant Signed-off-by: Matthias Weckbecker <[email protected]>
- Loading branch information
1 parent
2a885f9
commit 1ca675f
Showing
14 changed files
with
292 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pycodestyle] | ||
ignore = E221,E501,E731 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
from .object_base import ObjectBase | ||
|
||
|
||
class Components(ObjectBase): | ||
""" | ||
A `Components Object`_ holds a reusable set of different aspects of the OAS | ||
spec. | ||
.. _Components Object: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#componentsObject | ||
""" | ||
__slots__ = ['schemas','responses','parameters','examples','requestBodies', | ||
'headers','securitySchemes','links','callback'] | ||
__slots__ = ['schemas', 'responses', 'parameters', 'examples', 'headers', | ||
'requestBodies', 'securitySchemes', 'links', 'callback'] | ||
|
||
def _parse_data(self): | ||
""" | ||
Implementation of :any:`ObjectBase._parse_data` | ||
""" | ||
self.schemas = self._get('schemas', ['Schema','Reference'], is_map=True) | ||
self.responses = self._get('responses', ['Response','Reference'], is_map=True) | ||
self.parameters = self._get('parameters', ['Parameter','Reference'], is_map=True) | ||
self.examples = self._get('examples', ['Example','Reference'], is_map=True) | ||
self.requestBodies = self._get('requestBody', ['RequestBody', 'Reference'], is_map=True) | ||
#self.headers = self._get('headers', ['Header','Reference'], is_map=True) | ||
self.securitySchemes = self._get('securitySchemes', ['SecurityScheme','Reference'], is_map=True) | ||
#self.links = self._get('link', ['Link','Reference'], is_map=True) | ||
#self.callbacks = self._get('callbacks', ['Callback','Reference'], is_map=True) | ||
self.examples = self._get('examples', ['Example', 'Reference'], is_map=True) | ||
self.parameters = self._get('parameters', ['Parameter', 'Reference'], is_map=True) | ||
self.requestBodies = self._get('requestBody', ['RequestBody', 'Reference'], is_map=True) | ||
self.responses = self._get('responses', ['Response', 'Reference'], is_map=True) | ||
self.schemas = self._get('schemas', ['Schema', 'Reference'], is_map=True) | ||
self.securitySchemes = self._get('securitySchemes', ['SecurityScheme', 'Reference'], is_map=True) | ||
# self.headers = self._get('headers', ['Header', 'Reference'], is_map=True) | ||
# self.links = self._get('link', ['Link', 'Reference'], is_map=True) | ||
# self.callbacks = self._get('callbacks', ['Callback', 'Reference'], is_map=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,57 @@ | ||
from .object_base import ObjectBase | ||
|
||
|
||
class Info(ObjectBase): | ||
""" | ||
An OpenAPI Info object, as defined in `the spec`_. | ||
.. _the spec: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#infoObject | ||
""" | ||
__slots__ = ['title','description','termsOfService','contact','license','version'] | ||
required_fields = ['title','version'] | ||
__slots__ = ['title', 'description', 'termsOfService', 'contact', | ||
'license', 'version'] | ||
required_fields = ['title', 'version'] | ||
|
||
def _parse_data(self): | ||
""" | ||
Implementation of :any:`ObjectBase._parse_data` | ||
""" | ||
self.title = self._get('title', str) | ||
self.description = self._get('description', str) | ||
self.contact = self._get('contact', 'Contact') | ||
self.description = self._get('description', str) | ||
self.license = self._get('license', 'License') | ||
self.termsOfService = self._get('termsOfService', str) | ||
self.contact = self._get('contact', 'Contact') | ||
self.license = self._get('license', 'License') | ||
self.version = self._get('version', str) | ||
self.title = self._get('title', str) | ||
self.version = self._get('version', str) | ||
|
||
|
||
class Contact(ObjectBase): | ||
""" | ||
Contact object belonging to an Info object, as described `here`_ | ||
.. _here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#contactObject | ||
""" | ||
__slots__ = ['name','url','email'] | ||
__slots__ = ['name', 'url', 'email'] | ||
|
||
def _parse_data(self): | ||
""" | ||
Implementation of :any:`ObjectBase._parse_data` | ||
""" | ||
self.name = self._get('name', str) | ||
self.url = self._get('url', str) | ||
self.email = self._get('email', str) | ||
self.name = self._get('name', str) | ||
self.url = self._get('url', str) | ||
|
||
|
||
class License(ObjectBase): | ||
""" | ||
License object belonging to an Info object, as described `here`_ | ||
.. _here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#license-object | ||
""" | ||
__slots__ = ['name','url'] | ||
__slots__ = ['name', 'url'] | ||
required_fields = ['name'] | ||
|
||
def _parse_data(self): | ||
""" | ||
Implementation of :any:`ObjectBase._parse_data` | ||
""" | ||
self.name = self._get('name', str) | ||
self.url = self._get('url', str) | ||
self.url = self._get('url', str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.