Skip to content

Commit

Permalink
#154: Disable most of the Swagger generation for dev purposes
Browse files Browse the repository at this point in the history
- This will be modified later on
  • Loading branch information
MRichards99 committed Oct 22, 2020
1 parent 669a558 commit f0ff0a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def handle_error(e):
setup_logger()
log.info("Logging now setup")

initialise_spec(spec)
#initialise_spec(spec)

for entity_name in endpoints:
get_endpoint_resource = get_endpoint(entity_name, endpoints[entity_name])
Expand Down
16 changes: 16 additions & 0 deletions src/resources/entities/entity_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def get(self):
200,
)

'''
get.__doc__ = f"""
---
summary: Get {name}
Expand Down Expand Up @@ -61,13 +62,15 @@ def get(self):
404:
description: No such record - Unable to find a record in the database
"""
'''

def post(self):
return (
backend.create(get_session_id_from_auth_header(), table, request.json),
200,
)

'''
post.__doc__ = f"""
---
summary: Create new {name}
Expand Down Expand Up @@ -105,13 +108,15 @@ def post(self):
404:
description: No such record - Unable to find a record in the database
"""
'''

def patch(self):
return (
backend.update(get_session_id_from_auth_header(), table, request.json),
200,
)

'''
patch.__doc__ = f"""
---
summary: Update {name}
Expand Down Expand Up @@ -149,6 +154,7 @@ def patch(self):
404:
description: No such record - Unable to find a record in the database
"""
'''

Endpoint.__name__ = name
return Endpoint
Expand All @@ -172,6 +178,7 @@ def get(self, id_):
200,
)

'''
get.__doc__ = f"""
---
summary: Find the {table.__name__} matching the given ID
Expand Down Expand Up @@ -201,11 +208,13 @@ def get(self, id_):
404:
description: No such record - Unable to find a record in the database
"""
'''

def delete(self, id_):
backend.delete_with_id(get_session_id_from_auth_header(), table, id_)
return "", 204

'''
delete.__doc__ = f"""
---
summary: Delete {name} by id
Expand All @@ -231,12 +240,14 @@ def delete(self, id_):
404:
description: No such record - Unable to find a record in the database
"""
'''

def patch(self, id_):
session_id = get_session_id_from_auth_header()
backend.update_with_id(session_id, table, id_, request.json)
return backend.get_with_id(session_id, table, id_), 200

'''
patch.__doc__ = f"""
---
summary: Update {name} by id
Expand Down Expand Up @@ -273,6 +284,7 @@ def patch(self, id_):
404:
description: No such record - Unable to find a record in the database
"""
'''

EndpointWithID.__name__ = f"{name}WithID"
return EndpointWithID
Expand All @@ -299,6 +311,7 @@ def get(self):
200,
)

'''
get.__doc__ = f"""
---
summary: Count {name}
Expand All @@ -325,6 +338,7 @@ def get(self):
404:
description: No such record - Unable to find a record in the database
"""
'''

CountEndpoint.__name__ = f"{name}Count"
return CountEndpoint
Expand All @@ -351,6 +365,7 @@ def get(self):
200,
)

'''
get.__doc__ = f"""
---
summary: Get single {table.__name__}
Expand Down Expand Up @@ -380,6 +395,7 @@ def get(self):
404:
description: No such record - Unable to find a record in the database
"""
'''

FindOneEndpoint.__name__ = f"{name}FindOne"
return FindOneEndpoint

0 comments on commit f0ff0a1

Please sign in to comment.