Skip to content

Commit

Permalink
chore: functionality required of api/updatedict.py has changed since …
Browse files Browse the repository at this point in the history
…last editing node v3's swagger.json file
  • Loading branch information
randomshinichi committed Oct 10, 2019
1 parent 2df1c10 commit e851cfc
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions api/updatedict.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def no_implicit_int64(data):

return swaggerD.to_python()

def add_definitions(data):
def add_uint_bigint(data):
bigint = {
"type": "integer",
"minimum": 0,
Expand All @@ -44,45 +44,15 @@ def add_definitions(data):
"type": "BigInt"
}
}
data["definitions"]["Amount"] = bigint
data["definitions"]["Balance"] = bigint
data["definitions"]["Fee"] = bigint
data["definitions"]["NameSalt"] = bigint
data["definitions"]["Gas"] = bigint
data["definitions"]["GasPrice"] = bigint
data["definitions"]["UInt"] = bigint
return data

def add_references_to_definitions(data):
swaggerD = DottedDict(data)
for l in json_objects:
l_last_key = l.split('.')[-1]
swaggerD_old = swaggerD[l]
if 'fee' == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Fee"}
elif "balance" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Balance"}
elif "amount" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Amount"}
elif "channel_reserve" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Amount"}
elif "name_salt" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/NameSalt"}
elif "gas" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Gas"}
elif "gas_price" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/GasPrice"}
# I want to see what was changed.
if swaggerD[l] != swaggerD_old:
print(l, swaggerD[l])
return swaggerD.to_python()

with open('swaggerOrig.json') as f:
with open('rc2.json') as f:
swagger = json.load(f)
traverse(swagger, [])


swagger_n = add_definitions(swagger)
swagger_n = add_references_to_definitions(swagger_n)
swagger_n = add_uint_bigint(swagger)
swagger_n = no_implicit_int64(swagger_n)


Expand Down

0 comments on commit e851cfc

Please sign in to comment.