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

Feature request: support kotlinx.serialization #19

Closed
yrom opened this issue Feb 24, 2018 · 4 comments
Closed

Feature request: support kotlinx.serialization #19

yrom opened this issue Feb 24, 2018 · 4 comments

Comments

@yrom
Copy link

yrom commented Feb 24, 2018

Hi @wuseal ,very thanks for your awesome work.
Could you add support for the project kotlinx.serialization ?

  • Class should annotated with @Serializable
  • @Optional for optional property, but require default values
  • @SerialName for override property name with custom name

e.g.

@Serializable
class Data(val a: Int = 0, 
    @Optional val b: Int = 42, 
    @SerialName("c") val custom: String)


assertEquals("{a: 1, b: 42, c: test}", JSON.unquoted.stringify(Data(custom="test")))
@wuseal
Copy link
Owner

wuseal commented Feb 24, 2018

@yrom Of course ! Thanks for your awesome advice ,It will be complete in Version 1.7 about one week later.

@wuseal
Copy link
Owner

wuseal commented Mar 6, 2018

@yrom Hi,Version,1.7Pre1 has released ,you can download the jar and install plugin local Download the plugin
It add custom annotation with class and multiple annotation with property ,you could fix your request by select Others by customize option in annotation tab, the demo result code could like this:

import kotlinx.serialization.Serializable

import kotlinx.serialization.SerialName

import kotlinx.serialization.Optional
@Serializable
data class TestData(
		@Optional
		@SerialName("data")
		var data: Data = Data(),
		@Optional
		@SerialName("state")
		var state: Int = 0,
		@Optional
		@SerialName("err")
		var err: Any = Any()
)

The config dialog like this:
image
If there any problem ,Welcome to raise ,Em.. In this pre version ,I have a headache with the UI.If possible,Any one could help to optimize that ,Thanks.!

@yrom
Copy link
Author

yrom commented Mar 9, 2018

Looks good! I'll try it

@wuseal
Copy link
Owner

wuseal commented Apr 14, 2018

close this issue ,If any problem welcome to reopen or raise new issue,tks 😄

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

No branches or pull requests

2 participants