[go: up one dir, main page]

Skip to content

Refactor model validations in workspaces domain to remove redundant checks

MR: Pending

Description

This discussion !166343 (comment 2121215349) spun up an important conversation on how we validate models.

TLDR:

What we realised

some validations in ee/app/validators/remote_development/ mirror existing structural and type validations that ee/app/validators/json_schemas/\*.json already ensure.

Acceptance Criteria

We would need to clean up the existing validators that have redundant checks and update our docs to reflect how we handle custom validations

  • Asses the custom validator classes for redundant checks (those already present in a corresponding JSON schema) and remove them
  • Add model-level tests to compensate for those cleaned from the validator (you could use rspec table testing syntax to reduce boilerplate/verbosity example here).
  • Update workspace docs if necessary on the model validation pipeline, i.e utilize the JSON schema for as much validation as possible given the context, then for more complex logical validations that JSON spec cannot handle, use a validator class
Edited by Safwan Ahmed