Skip to content

Commit

Permalink
#50: Create SwaggerSpec class
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Sep 17, 2019
1 parent 412a895 commit e2c2c8f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/swagger/swagger_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,36 @@ def __init__(self, entity_name):
}


class SwaggerSpecification(object):
def __init__(self):
self.paths = []
self.top_part = {
'openapi': "3.0.0",
"info": {
"title": "DataGateway API",
"description": "ICAT API to interface with the DataGateway",
"version": "0"
},
"servers": [
{
"url": "http://localhost:5000"
}
],
"paths": {}
}

def add_path(self, path):
self.paths.append(path)

def get_spec_as_dict(self):
spec = {}
for path in self.paths:
self.top_part["paths"].update(path)
spec.update(self.top_part)

return spec


class SwaggerGenerator(object):
FILE_PATH = Path.cwd() / "swagger" / "openapi.yaml"

Expand Down

0 comments on commit e2c2c8f

Please sign in to comment.