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

Disallow unknown fields #2

Closed
pcvolkmer opened this issue Dec 11, 2024 · 0 comments · Fixed by #5
Closed

Disallow unknown fields #2

pcvolkmer opened this issue Dec 11, 2024 · 0 comments · Fixed by #5
Assignees
Labels
enhancement New feature or request

Comments

@pcvolkmer
Copy link
Collaborator

Fail if unknown fields occur in JSON string to be deserialised by replacing UnmarshalMtb(..) with

func UnmarshalMtb(data []byte) (Mtb, error) {
	var r Mtb
	dec := json.NewDecoder(bytes.NewReader(data))
	dec.DisallowUnknownFields()
	err := dec.Decode(&r)
	return r, err
}

This should provide more strict serde.

@pcvolkmer pcvolkmer self-assigned this Dec 11, 2024
@pcvolkmer pcvolkmer added the enhancement New feature or request label Dec 11, 2024
@pcvolkmer pcvolkmer linked a pull request Dec 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant