Open thachnb85 opened 3 years ago
Same here. Any solution?
I think it's a an issue with the api. Will try to see how I can fix mine!
I think it's the JSON input. There's a number when we're expecting a string.
The json kind in the sample is a discovery#restDescription but mine is discovery#directoryList, did I build my app engine app wrongly? who knows how I can get it in the former kind?
I solved my own problem here https://github.com/google/googleapis.dart/issues/289#issue-981804466. I don't know if anyone has the same issue.
@Greatcallie I ended up using the older version 0.9.15 and did 2 hijacking spots:
In v1.dart
:
And in dart_resources.dart
I'm able to generate dart code for my discovery doc.
Yup. It seems the json has "description": null,
which is not expected/handled by our encoder.
Where are you getting your descriptions? Could you simple remove these null entries?
Thanks @kevmoo for replying.
I checked my json file and that descriptions are not null, here is a part of json file
{
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/userinfo.email": {
"description": "https://www.googleapis.com/auth/userinfo.email"
}
}
}
},
"basePath": "/_ah/api/sync/v1/",
"baseUrl": "http://myapp.appspot.com/_ah/api/sync/v1/",
"batchPath": "batch",
"description": "Sync API",
"discoveryVersion": "v1",
"icons": {
"x16": "http://www.google.com/images/icons/product/search-16.gif",
"x32": "http://www.google.com/images/icons/product/search-32.gif"
},
"id": "sync:v1",
"kind": "discovery#restDescription",
"methods": {
"getAccount": {
"httpMethod": "GET",
"id": "sync.getAccount",
"parameterOrder": [
"id"
],
"parameters": {
"id": {
"format": "int64",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "GetAccount/{id}",
"response": {
"$ref": "Account"
},
"scopes": [
"https://www.googleapis.com/auth/userinfo.email"
]
},
}
It seems now I saw a lot of error related to data conversion from json to object, (for example expecting int but seeing String and vice versa), I checked the generated code (v1.dart) and found that I have to do this manually everywhere to match int/String type when converting (fromJson
methods for all objects)
One example of converting String to int, which isn't handled by generator:
Any suggests? Thank you!
So we're set up now to continue to treat int64 like a String – this is because Javascript cannot support numbers beyond the range of pow(2, 53) without truncating values.
So we leave the values as String.
I know this is annoying, but it's a limitation we've kinda lived with.
I could imagine having helpers here to expose the value as an int by converting on-the-fly.
Hello Google developers,
I got this error when launching
discoveryapis_generator
My install log
Fluttter doctor output
I tried both stable channel and master channel, and got the similar error log.
Moreover, when running the generator on my API's json, it throws this error:
Appreciate any idea to resolve this issue! Thank you.