Wrap use of JSONSchemer in Gitlab::JsonSchema
Problem
In #351777 (closed) and https://gitlab.com/gitlab-org/gitlab/-/issues/351904 we fixed invalid JSON schemas.
Proposed solution
In order to prevent future cases of invalid JSON schema we could wrap the use of JSONSchemer
in Gitlab::JsonSchema
and provide a flag Gitlab::JsonSchema.validate_schema = true|false
which be enabled in test
|development
but disabled in production
(for now or behind a feature flag)
Similar to the "spec matcher" the wrapper should take care of resolving $ref
properly.
Add a RuboCop Gitlab::JsonSchema
instead of the direct use of JSONSchemer
.
Edited by Peter Leitzen