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

Make kotlinx.serialization.json.Json.configuration public #1361

Closed
comahe-de opened this issue Mar 8, 2021 · 2 comments
Closed

Make kotlinx.serialization.json.Json.configuration public #1361

comahe-de opened this issue Mar 8, 2021 · 2 comments

Comments

@comahe-de
Copy link

Hi,

I want to write a custom serializer, where I also need to access the configuration of the Json class . But it is marked a internal

public sealed class Json(internal val configuration: JsonConf) : StringFormat {

So I have to use this hack to access the configuration

        val decoder: JsonDecoder = ...
        var classDiscriminatorConfig: String? = null
        Json(decoder.json) {
            classDiscriminatorConfig = classDiscriminator // the value I want to know
        }

So I would like to change the visibility of kotlinx.serialization.json.Json.configuration to public:

    public sealed class Json(val configuration: JsonConf) : StringFormat {

and also kotlinx.serialization.json.internal.JsonConf to be to public (and moving to package kotlinx.serialization.json)

package kotlinx.serialization.json
...
data class JsonConf
@comahe-de comahe-de changed the title Make kotlinx.serialization.json.Json.configuration Make kotlinx.serialization.json.Json.configuration public Mar 8, 2021
@qwwdfsad qwwdfsad added the json label Mar 15, 2021
@qwwdfsad
Copy link
Member

Thanks for the use-case! We'll reconsider our decision for the next major version

@sandwwraith
Copy link
Member

Same problem: #1323

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

3 participants