Skip to content
Snippets Groups Projects
Commit 8724ce06 authored by Janis Streib's avatar Janis Streib :owl:
Browse files

ADD: swagger: object definitions (#152)

parent 0f9a6d52
No related branches found
No related tags found
No related merge requests found
Pipeline #271376 passed with warnings
......@@ -171,10 +171,10 @@ def generateParamters(f):
props = {}
if len(old_params) > 0:
props['old'] = {
'description': 'Alte Attribute zur einduetigen Identifizierung des Objekts',
'type': 'object',
'properties': old_params,
}
'description': 'Alte Attribute zur einduetigen Identifizierung des Objekts',
'type': 'object',
'properties': old_params,
}
if len(new_params) > 0:
props['new'] = {
'description': 'Neue Angaben',
......@@ -191,8 +191,12 @@ def generateParamters(f):
}
}]
systems = sess.get(
"{scheme}://{base_host}{base_url}/".format(scheme=API_SCHEME, base_host=API_HOST, base_url=API_BASE_URL))
objects = sess.get(
"{scheme}://{base_host}{base_url}/wapi/object_type/list".format(scheme=API_SCHEME, base_host=API_HOST, base_url=API_BASE_URL)).json()[0]
swagger['tags'] = systems.json()[0]
swagger['securityDefinitions'] = {'api_key': {'type': 'apiKey', 'name': 'Authorization', 'in': 'header'}}
swagger['paths'] = {f"/{f['system']}/{f['object_type']}/{f['name']}":
......@@ -218,5 +222,19 @@ swagger['paths'] = {f"/{f['system']}/{f['object_type']}/{f['name']}":
}}}
for f in func_index
}
swagger['definitions'] = {o['name']:
{
'type': 'object',
'description': o['description'],
'properties': {
a: {
'type': d['dataType']['jsonName'],
'description': d['description']
}
for a, d in o['attributes'].items()}
}
for o in objects
}
with open(SWAGGER_TARGET_FILE, 'w') as f:
f.write(json.dumps(swagger))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment