feat(linter): Improve linting by validating examples in nested schemas (T424002)

We consider a schema to satisfy the requirement to have examples only when all recursively traversed nested schemas have examples.

  • Refactor findNestedExamples to coordinate recursive traversal.
  • Extract nested example validation logic into dedicated evaluateNestedExamples function.
  • Introduce Set that helps prevent infinite recursion on self-referencing schemas.
  • Use WeakMap validation cache to memoize example check outcomes on shared schema objects, to prevent redundant walks.
  • Align keyword lists with ruleset's existing traversed keywords checklist.
  • Adjust linter warning messages.
  • Add missing examples in oad_example.yaml to comply with most up-to-date rules.
  • Add and modify tests. Verify that new and old tests pass.

Why?

Previously, the code returned true if any property had an example. Now we want to recursively enforce examples in all relevant nested schemas. 

Closes T424002

Closes T426836

Edited by KineticPelagic

Merge request reports

Loading