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

Support for multiple alternative names during JSON parsing #597

Closed
wants to merge 6 commits into from

Conversation

sandwwraith
Copy link
Member

  • Configurable via @JsonAlternativeNames annotation
  • Uses new DescriptorSchemaCache – class for associating custom format info with descriptors in effective and type-safe way
  • Stabilize .toString() for SerialClassDescImpl; because HashMaps on different platforms have different iteration order

Fixes #203

@sandwwraith sandwwraith self-assigned this Nov 6, 2019
Introduce DescriptorSchemaCache class
Stabilize .toString() for SerialClassDescImpl; because HashMaps on different platforms have different iteration order
Hold cache in Json instance instead of passing it everywhere
Now cache map is not created if main name for property is used
* This cache uses ConcurrentHashMap on JVM and regular maps on other platforms.
* To be able to work with it from multiple threads in Kotlin/Native, use @[ThreadLocal] in appropriate places.
*/
internal class DescriptorSchemaCache {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type seems like it would be good to be public. It is something that many formats could reuse.

@mochadwi
Copy link

mochadwi commented Jun 5, 2020

really love to wait for this features merged

@lic2050
Copy link

lic2050 commented Sep 22, 2020

hi, When can this be used?

@sandwwraith
Copy link
Member Author

Postponed for after-1.0.0 (1.1.0 likely)

@kevinvandenbreemen
Copy link

Postponed for after-1.0.0 (1.1.0 likely)

Hey there,
I am also on a team that could really use this feature. We are migrating code from GSon, and some of our serialized fields have alternate names.

@mustafaozhan
Copy link

Hi there 👋 Same here I am really looking forward to this PR to be merged and released 😞

@krottv
Copy link

krottv commented Jan 25, 2021

I am also looking for this feature. Also it would be nice if aliases could be processed differently. Like I have "durationFrames": 30, "durationMillis": 1000. So json can contain one of the following items.

@mustafaozhan
Copy link

Unfortunately 1.1.0 Released without this feature, When It can be used ?

@sandwwraith
Copy link
Member Author

@mustafaozhan We plan it for the next release

@sandwwraith
Copy link
Member Author

Superseded by #1375

@mustafaozhan
Copy link

@sandwwraith glad to hear that thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants