Commit 0898e735 authored by Gábor Szalai's avatar Gábor Szalai
Browse files

OpenApi.py update


Signed-off-by: Gábor Szalai's avatarGabor Szalai <gabor.szalai@ericsson.com>
parent 93231d95
......@@ -356,7 +356,7 @@ def type_builder(name,data,tree):
module_data['import'].append("JSON_Generic")
else:
element_data["type"]=data["type"]
print('!!!!!!unsupported' + data["type"])
#print('!!!!!!unsupported' + data["type"])
elif "$ref" in data:
refmodule,refstr=get_module(data["$ref"])
......@@ -417,8 +417,8 @@ def type_builder(name,data,tree):
element_data["type"]="JSON_Generic.JSON_generic_val"
if not "JSON_Generic" in module_data['import']:
module_data['import'].append("JSON_Generic")
print('!!!!!!unsupported ',name)
pprint.pprint(data)
#print('!!!!!!unsupported ',name)
#pprint.pprint(data)
if "nullable" in data:
if not "JSON_Generic" in module_data['import']:
......@@ -455,8 +455,6 @@ def print_type(t, lend="\n", top=False):
if "mandatory" in t:
if f["name"] not in t["mandatory"]:
print(" optional", end="")
if f["nullable"]:
print("/* nullable */", end="",sep="")
ident_level-=1
print("",sep="")
print(ident_c*ident_level,"}",sep="",end=lend)
......@@ -521,7 +519,19 @@ if "components" in doc:
schemas=doc["components"]["schemas"]
for name in schemas:
if (name[-2:] == "Rm" ) and (name[:-2] in schemas ):
type_tree.append({'name':clean_name(name,True),'type':clean_name(name[:-2],True)})
type_tree.append({'fields': [{'name': 'null_val',
'nullable': False,
'type': 'JSON_generic_val.JSON_null_val'},
{'name': 'val',
'nullable': False,
'type': clean_name(name[:-2],True),
'variant': []}],
'name': clean_name(name,True),
'nullable': True,
'type': 'union',
'variant': ['JSON: as value']})
elif name == "NullValue":
type_tree.append({'type': 'JSON_generic_val.JSON_null_val','name':'NullValue','nullable': True})
else:
data=schemas[name]
type_builder(clean_name(name,True),data,type_tree)
......@@ -585,4 +595,4 @@ print('} with {')
print(' encode "JSON"')
print('}')
pprint.pprint(type_tree)
#pprint.pprint(type_tree)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment