OpenAPITools / OpenAPITools/openapi-generator
[BUG] scala-akka issues
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
The scala-akka client has the following issues/limitations:
1. All responses must be documented.
If a response is not documented, an exception will be thrown
The line for this behavior is https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala#L283
2. Enum is not working as expected
Enum (e..g status in Petstore) is converted to {}, e.g.
{"id":1000,"category":{"id":1,"name":"sold"},"name":"dragon","photoUrls":["http://foo.com/photo/1","http://foo.com/photo/2","http://foo.com/photo/3","http://foo.com/photo/4","http://foo.com/photo/5","http://foo.com/photo/6","http://foo.com/photo/7","http://foo.com/photo/8","http://foo.com/photo/9","http://foo.com/photo/10"],"tags":[{"id":1,"name":"tag-1"},{"id":2,"name":"tag-2"},{"id":3,"name":"tag-3"},{"id":4,"name":"tag-4"},{"id":5,"name":"tag-5"}],"status":{}}
Note the "status":{} at the end of the payload
Removing https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala#L29 from the payload works around the issue for the time being.
3. ContentType is not used in the request
Even content type is set to "application/json" in the request, still "applicatin/octat-stream" is used instead". The line seems to cause the issue is
I can workaround the issue by hard coding the following but it's clearly not going to work for all cases.
ContentType(MediaTypes.`application/json`)
openapi-generator version
Latest master
OpenAPI declaration file content or url
petstore.json/yaml
Command line used for generation
./bin/scala-akka-petstore.sh
Steps to reproduce
Run "sbt test" under scala-akka petstore folder.
Suggest a fix
See above
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
Start with samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala at the referenced lines, then run sbt test in the scala-akka petstore folder. Review samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala and the generated petstore output for undocumented responses, enum serialization, and request ContentType. Done means all three reported behaviors are covered by passing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100