Skip to content

Conversation

PaulVanSchayck
Copy link
Collaborator

@PaulVanSchayck PaulVanSchayck commented Jul 5, 2024

This add support for a generic CoverageJSON type which you can use to validate any JSON against. It implements the root types that can form a CoverageJSON, as defined in the spec.

I've considered (and tested) the implementations listed in this detailed SO answer. In the end I've chosen for Option A.

Option B (Custom Root Type): Very noisy implementation, and forgetting your dealing with a proxy object. It's also not easy to use for validation purposes.

Option C (Union field + proxy constructor): The fake class (as function) is not very clean. It's also not easy use for validation.

For the (lightweight) purpose of validation, Option A seems to be the cleanest to use.

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

Successfully merging this pull request may close these issues.

1 participant