Skip to content

Commit ac7fd40

Browse files
committed
Use integer and uint64 tro better express the genesis schema
This will allow `generator` to understand create model types.
1 parent 8341e41 commit ac7fd40

File tree

11 files changed

+905
-890
lines changed

11 files changed

+905
-890
lines changed

daemon/algod/api/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ server/v2/generated/model/types.go: algod.oas3.yml
3333
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/model/model_types.yml algod.oas3.yml
3434

3535
algod.oas3.yml: algod.oas2.json
36-
jq < algod.oas2.json > /dev/null # fail with a nice explantion if json is malformed
36+
jq < algod.oas2.json > /dev/null # fail with a nice explantion if json is malformed
37+
! grep '"type": "number"' $< # Don't use the number type. Use integer (and format uint64 usually)
3738
curl -s -X POST "$(SWAGGER_CONVERTER_API)/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./algod.oas2.json -o .3tmp.json
3839
python3 jsoncanon.py < .3tmp.json > algod.oas3.yml
3940
rm -f .3tmp.json

daemon/algod/api/algod.oas2.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3092,10 +3092,11 @@
30923092
"type": "object",
30933093
"properties": {
30943094
"algo": {
3095-
"type": "number"
3095+
"type": "integer",
3096+
"format" : "uint64"
30963097
},
30973098
"onl": {
3098-
"type": "number"
3099+
"type": "integer"
30993100
},
31003101
"sel": {
31013102
"type": "string"
@@ -3107,13 +3108,16 @@
31073108
"type": "string"
31083109
},
31093110
"voteKD": {
3110-
"type": "number"
3111+
"type": "integer",
3112+
"format" : "uint64"
31113113
},
31123114
"voteFst": {
3113-
"type": "number"
3115+
"type": "integer",
3116+
"format" : "uint64"
31143117
},
31153118
"voteLst": {
3116-
"type": "number"
3119+
"type": "integer",
3120+
"format" : "uint64"
31173121
}
31183122
},
31193123
"required": [
@@ -3159,7 +3163,8 @@
31593163
"type": "string"
31603164
},
31613165
"timestamp": {
3162-
"type": "number"
3166+
"type": "integer",
3167+
"format" : "int64"
31633168
}
31643169
},
31653170
"required": [

daemon/algod/api/algod.oas3.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,8 @@
20872087
"type": "string"
20882088
},
20892089
"timestamp": {
2090-
"type": "number"
2090+
"format": "int64",
2091+
"type": "integer"
20912092
}
20922093
},
20932094
"required": [
@@ -2113,10 +2114,11 @@
21132114
"state": {
21142115
"properties": {
21152116
"algo": {
2116-
"type": "number"
2117+
"format": "uint64",
2118+
"type": "integer"
21172119
},
21182120
"onl": {
2119-
"type": "number"
2121+
"type": "integer"
21202122
},
21212123
"sel": {
21222124
"type": "string"
@@ -2128,13 +2130,16 @@
21282130
"type": "string"
21292131
},
21302132
"voteFst": {
2131-
"type": "number"
2133+
"format": "uint64",
2134+
"type": "integer"
21322135
},
21332136
"voteKD": {
2134-
"type": "number"
2137+
"format": "uint64",
2138+
"type": "integer"
21352139
},
21362140
"voteLst": {
2137-
"type": "number"
2141+
"format": "uint64",
2142+
"type": "integer"
21382143
}
21392144
},
21402145
"required": [

daemon/algod/api/server/v2/generated/data/routes.go

Lines changed: 75 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)