Skip to content

Commit

Permalink
Revert to bb164ae (committed to wrong branch)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartpullinger committed Nov 22, 2019
1 parent bc55c74 commit 1d84c39
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions src/swagger/swagger_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,41 +246,6 @@ def __init__(self, entity_name, model):
}
}
}
self.entity_findone_endpoint = {
f"/{entity_name.lower()}/findone": {
"get": {
"summary": f"Get one {SwaggerGenerator.singularise(entity_name).lower()} entity based on filters",
"tags": ["entities"],
"parameters": [self.WHERE_PARAMETER,
self.DISTINCT_PARAMETER,
self.INCLUDE_PARAMETER,
self.LIMIT_PARAMETER,
self.ORDER_PARAMETER,
self.SKIP_PARAMETER],
"responses": {
"200": {
"description": f"The first {SwaggerGenerator.singularise(entity_name).lower()} entity found",
"content": {
"application/json": {
"schema": {
"$ref": f"#/components/schemas/{SwaggerGenerator.singularise(entity_name)}"
}
}
}
},
"404": {
"description": "When no results are found"
},
"401": {
"description": "When no credentials are provided"
},
"403": {
"description": "When bad credentials are provided"
}
}
}
}
}


class SwaggerSpecification(object):
Expand All @@ -301,7 +266,7 @@ def __init__(self):
],
"paths": {},
"components": {
"schemas": {}
"schemas":{}
}
}

Expand Down Expand Up @@ -337,7 +302,7 @@ def pascal_to_normal(input):
return " ".join(map(str.lower, words))

@staticmethod
def singularise(plural_word: str):
def singularise(plural_word:str):
if plural_word.lower().endswith('ies'):
singular_word = plural_word[:-3] + ('Y' if plural_word.isupper() else 'y')
elif plural_word.lower().endswith('s'):
Expand All @@ -358,7 +323,6 @@ def write_swagger_spec(self):
swagger_spec.add_path(entity.entity_count_endpoint)
swagger_spec.add_path(entity.entity_id_endpoint)
swagger_spec.add_path(entity.entity_no_id_endpoint)
swagger_spec.add_path(entity.entity_findone_endpoint)
swagger_spec.add_schema(entity.entity_schema)
swagger_dict = swagger_spec.get_spec_as_dict()
yaml.Dumper.ignore_aliases = lambda *args: True
Expand Down

0 comments on commit 1d84c39

Please sign in to comment.