-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
discussIssue needs discussionIssue needs discussion
Description
We are using jsonschema for validation, one of the targets was to try to define a spec that can be easily validated in other languages that have support for jsonschema, but we have needed several customizations that required more Go code, making difficult to use the spec in other languages.
Some options we have to solve the issues found can be the following ones, we probably need a mix of them to address all issues:
- Use some other framework for validation of directory structure.
- Use a more extensible
jsonschemalibrary for validation of json/yaml files. - Fully replicate the same logic in other languages, and implement a solution to certify the different implementations.
- Expose spec validation functionality through a CLI tool.
- Expose spec validation functionality through some portable target such as WebAssembly (POC).
Limitations found:
- jsonschema is good for the structure of json/yaml files, but we also try to use something similar for the structure of directories. This validation of directories requires additional custom logic.
- We need some custom validation of fields in yaml files that go beyond the basic json types, and this is tricky to implement with current library (for example we check that relative paths exist and comply with size limits using a custom formatter, but this is not about format, and formatters cannot be parameterized).
- Current library doesn't have good support for virtual filesystems, what produces issues on Windows, Fix package validation on Windowsย #358.
- "Semantic" validation requires additional completely custom code.
- We are using jsonschema to validate yaml files, this works fine by now, but there may be tricky cases, and this may limit portability of the spec.
- Custom code is not portable to other languages.
Other things to take into account:
- When reusing the same code in different places, we may need to be less strict on some checks. For example elastic-package can be strict on
additionalContents, but if Kibana is strict on that, new packages may not work in old versions of Kibana.
joshdover
Metadata
Metadata
Assignees
Labels
discussIssue needs discussionIssue needs discussion