Skip to content

[BUG] scala-akka issues #2684

Open
Open
@wing328

Description

@wing328

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

https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala#L290

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions