kiterunner
kiterunner copied to clipboard
kiterunner kb fails: error="failed to unmarshal param: json: ...
Any idea what is causing this bug and how to fix it?
% ./kr version -q
1.0.2 - e7a7fa6
Built on 2021-04-11T09:51:54Z
% ./kr kb -v debug -q compile routes-small.json testd.kite
6:01AM DBG custom log settings format=pretty
6:01AM DBG beginning slow load of json bytes
6:02AM DBG Context=root.[].v ID=root Method= Route=
6:02AM DBG Context=api.paths.operations.parameters ID=0cc39f6e72c06b91fbe278994d5ec9f40c67eece Method=post Route=/onos/vtn/subnets
6:02AM DBG error="failed to unmarshal param: json: cannot unmarshal array into Go struct field Parameter.schema of type kitebuilder.Schema" Context=param.[].v ID= JSON={"in":"body","name":"input","required":true,"schema":[]} Method= Route=
6:02AM DBG Context=api.paths.operations.parameters ID=0cc39f6e72c06b91fbe278994d5ec9f40c67eece Method=post Route=/onos/vtn/routers
6:02AM DBG error="failed to unmarshal param: json: cannot unmarshal array into Go struct field Parameter.schema of
p type kitebuilder.Schema" Context=param.[].v ID= JSON={"in":"body","name":"input","required":true,"schema":[]} Method= Route=
[...]
I'm having the same error:
3:31PM DBG custom log settings format=pretty
3:31PM INF converting input=swagger.json input-type=JSON output=swagger.kite output-type=KITE
3:31PM FTL failed to convert files error="conversion error: parsing kitebuilder json input error: failed to unmarshal json: json: cannot unmarshal object into Go value of type []kitebuilder.API"
Same here:
9:26AM DBG custom log settings format=pretty
9:26AM DBG beginning slow load of json bytes
9:26AM FTL failed to read from stdin error="failed to parse json: failed to unmarshal json: json: cannot unmarshal object into Go value of type []interface {}"
is the project dead?
The json is "openapi" : "3.0.0",
reproduce:
wget https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/api-with-examples.json
kr kb -v debug -q compile api-with-examples.json api-with-examples.kite
@@ -1,8 +1,4 @@
-[{
- "ksuid": "0cc39f6e1cc6849fd26c5581c91c728dbd1ce634",
- "url": null,
- "securityDefinitions": {},
-
+{
"openapi": "3.0.0",
"info": {
"title": "Simple API overview",
@@ -12,7 +8,7 @@
"/": {
"get": {
"operationId": "listVersionsv2",
- "description": "List API versions",
+ "summary": "List API versions",
"responses": {
"200": {
"description": "200 response",
@@ -69,7 +65,7 @@
"/v2": {
"get": {
"operationId": "getVersionDetailsv2",
- "description": "Show API version details",
+ "summary": "Show API version details",
"responses": {
"200": {
"description": "200 response",
@@ -168,5 +164,4 @@
}
}
}
-}
-]
+}
the format was the problem (obviously)
especially: input must be a list ([]), the path>method needs a description and each list element needs a ksuid, url and securityDefintion