Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kiterunner kb fails: error="failed to unmarshal param: json: ... #56

Open
zrthstr opened this issue Dec 23, 2022 · 3 comments
Open

kiterunner kb fails: error="failed to unmarshal param: json: ... #56

zrthstr opened this issue Dec 23, 2022 · 3 comments

Comments

@zrthstr
Copy link

zrthstr commented Dec 23, 2022

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=
[...]
@eugui
Copy link

eugui commented Jan 4, 2023

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"

@eulenleber
Copy link

eulenleber commented Jul 11, 2023

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

@eulenleber
Copy link

@@ -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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants