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

JsonScalaEnumeration with collection Seq/Set #582

Closed
randers-bit opened this issue Jun 30, 2022 · 6 comments
Closed

JsonScalaEnumeration with collection Seq/Set #582

randers-bit opened this issue Jun 30, 2022 · 6 comments

Comments

@randers-bit
Copy link

Hello i read FAQ and i know that when serializing Enumerations @JsonScalaEnumeration annotations should be used like described.

But what to do when enumeration is in collecion like Set/Seq?

I asked on stack overflow in context of swagger - Stack Overflow question but now i encountered old version of enumeration serialization in akka persistence and im concerned how to resolve this.

I it seems like missing documentation or functionality for this.

@pjfanning
Copy link
Member

This project is unaffiliated with swagger-akka-http - closing - I will open an issue over there

@pjfanning
Copy link
Member

@pjfanning
Copy link
Member

PS that JsonScalaEnumeration only works with enum instances directly, not if they are wrapped by collections.

@randers-bit
Copy link
Author

I found that myself about JsonScalaEnumeration, like i wrote in stack overflow.
In swagger i found answer acceptable for generating proper swagger file but now im concerned about journal in akka persistence.

I found that in journal enums in array are generated like in wiki for deprecated version
{"weekday":{"enumClass":"Weekday","value":"Fri"}} but i didn't saw any deprecation warnings in logs or anything, and it seems to work properly.

It is safe to assume that this format will work and just leave it or i should be worried about it in future/now?

@pjfanning
Copy link
Member

pjfanning commented Jun 30, 2022

I don't know anything about akka persistence. I never ever use Scala 2 enumerations. They are not deprecated but there are better alternatives - Enumeratum for Scala 2 and the new Scala 3 enums if you want to use Scala 3.

There are some tests relating to Scala 2 enumerations that don't work in Scala 3 - eg #535

@randers-bit
Copy link
Author

Thank you for your answers @pjfanning :)

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

2 participants