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

add openapi 3.0.3 support #26

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pyramid_georest/lib/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from yaml import load
from pyramid.path import AssetResolver

from pyramid_georest.lib.openapi import Schema


def translate(string_to_translate, dictionary, lang='de'):
"""
Expand Down Expand Up @@ -361,3 +363,17 @@ def is_valid_column(self, column_name):
return True
else:
return False

def open_api(self):
description = self.as_dict()
schema = {
'type': 'object',
'properties': {}
}
required = []
for column_name in description['columns'].keys():
if not description['columns'][column_name]['nullable']:
required.append(column_name)
if len(required) > 0:
schema['required'] = required
return Schema(schema)
Loading