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

Customization lambda for Json.ignoreUnknownKeys #2421

Closed
kunyavskiy opened this issue Aug 26, 2023 · 4 comments
Closed

Customization lambda for Json.ignoreUnknownKeys #2421

kunyavskiy opened this issue Aug 26, 2023 · 4 comments

Comments

@kunyavskiy
Copy link

What is your use-case and why do you need this feature?

We have a config file, which is json. On the one side, I want to disable unknown keys so that one can receive an error when they mistyped the config key. On the other side, this would disallow something like #comment key in the config, which can be quite useful.

Describe the solution you'd like

I suggest adding something like JsonConfiguration.isAllowedUnknowKey: (String, SerialDescriptor) -> Unit, where end-user can decide if this unknown key is fine or not.

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Aug 28, 2023

On the other side, this would disallow something like #comment key in the config, which can be quite useful.

Isn't it the case that something like Json5 support is what would be nicer here?

@kunyavskiy
Copy link
Author

kunyavskiy commented Aug 28, 2023

That sounds even better but much harder. Do you have any plans on json5 support? Or do you recommend community-driven formatted as good enough?

@qwwdfsad
Copy link
Collaborator

We are considering it as one of the features in the next major release

@sandwwraith
Copy link
Member

I'll close this as a duplicate of #797 then.

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