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

Content data is not validated when used as a library #248

Closed
javagl opened this issue Dec 8, 2022 · 1 comment
Closed

Content data is not validated when used as a library #248

javagl opened this issue Dec 8, 2022 · 1 comment

Comments

@javagl
Copy link
Contributor

javagl commented Dec 8, 2022

When the validator is used as a library (and not as a command line application), then the content data is currently not validated.

This is caused by the registration of the content data validators only happening in main.ts.

This is already being addressed, and will be fixed with the next release.

@javagl
Copy link
Contributor Author

javagl commented Dec 13, 2022

This should be fixed in the 0.2.0 release, via #247

The current approach is to call the registration functions whenever a public method is called (and keeping track of whether the registrations have already been performed, using a boolean flag). A conceptually cleaner and more elegant solution could be to use Static Initializer Blocks. But there, some details of the behavior apparently depend on the order in which classes are loaded, which appears to be brittle and error-prone (also see #224 (comment) ).

The approach for registering content types or extension validators may have to be reviewed when there should be an API-level (or even CLI-level) mechanism for defining and supplying custom validators. But until then, the current solution should be a reasonable one.

@javagl javagl closed this as completed Dec 13, 2022
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

No branches or pull requests

1 participant