swagger-api / swagger-api/swagger-codegen
[codegen - java]
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
If i generate a java client from https://api.my-clay.com/swagger/ui/index#/ i got a exception with the version 2.2.3.
with Version 2.3.0-20171030.060918-211 and 3.0.0-20171009.075709-6 the code will generated.
Swagger-codegen version
2.2.3 - gen error
2.3.0-20171030.060918-211 - code generated but not work
3.0.0-20171009.075709-6 - code generated but not work
Swagger declaration file content or url
HTTP/1.1 200 OK (497ms)
Content-Length: 5259
Content-Type: application/json; odata.metadata=minimal
Server: Microsoft-HTTPAPI/2.0
OData-Version: 4.0
X-API-Version: 1.1.0.338
Date: Sun, 12 Nov 2017 14:09:43 GMT
OkHttp-Sent-Millis: 1510495201090
OkHttp-Received-Millis: 1510495201355
{
"@odata.context":"https://api.my-clay.com/api/odata/$metadata#tags","value":[
{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000001","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Demokoffer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000002","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000003","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000004","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000005","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000006","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000007","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000008","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000009","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000010","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000011","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000012","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Demokoffer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000013","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Demokoffer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000014","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000015","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000016","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000017","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000018","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000019","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
},{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","number":"00000020","blocked_system_ids":[
],"is_assigned":true,"system":{
"id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","customer_reference":"Sample Customer"
}
}
],"@odata.nextLink":"https://api.my-clay.com/api/odata/tags?$skip=20"
END HTTP (5259-byte body)
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
at com.google.gson.Gson.fromJson(Gson.java:900)
at com.google.gson.Gson.fromJson(Gson.java:853)
at com.google.gson.Gson.fromJson(Gson.java:802)
at io.swagger.client.JSON.deserialize(JSON.java:104)
at io.swagger.client.ApiClient.deserialize(ApiClient.java:669)
at io.swagger.client.ApiClient.handleResponse(ApiClient.java:872)
at io.swagger.client.ApiClient.execute(ApiClient.java:799)
at io.swagger.client.api.TagsApi.dataapitagsWithHttpInfo(TagsApi.java:134)
at io.swagger.client.api.TagsApi.dataapitags(TagsApi.java:121)
at com.Main.main(Main.java:40)
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
please create a Gist (https://gist.github.com) or upload it somewhere else and
link it here.
Command line used for generation
java -jar lib\swagger-codegen-cli-2.3.0-20171030.060918-211.jar generate -i https://api.my-clay.com/swagger/docs/v1 -l java -o .\
Steps to reproduce
In the genrated code the type declaration is missing in a lot of points, you have to define via hand final (String/Integer/Boolean) and in every api java file replace the line:
String[] localVarAuthNames = new String[] { };
with
String[] localVarAuthNames = new String[] { "BearerToken" };
Related issues/PRs
Suggest a fix/enhancement
What can i do to fix the Problems with the paging and the exception?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the listed swagger-codegen CLI command against the supplied Swagger URL and inspect the generated TagsApi.java, ApiClient.java, and JSON.java alongside the Gson stack trace. A useful result would first narrow the report to a reproducible failure involving generated types, response deserialization, paging, or authentication, with the expected behavior stated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100