redocly-cli
redocly-cli copied to clipboard
$.components.schemas.*.example are not validated when no path reference them.
Describe the bug
It seems that examples in $.components.schemas are not validated if they are not referenced from a path.
Usually schemas are references from a path. However, x-tags
allow to sometimes break this rule.
Observed behavior means that examples of those schemas are not validated which is unexpected and error prone.
To Reproduce Steps to reproduce the behavior:
- Given any
redocly.yaml
file - And this OpenAPI file(s)
openapi: 3.1.0
info:
title: any
version: 2024-03-15
tags:
- name: my-tag
description: any
components:
schemas:
MySchema:
x-tags:
- my-tag
required:
- id
properties:
id:
type: string
example:
not-id: "any"
- Run this command with these arguments...
redocly ...
redocly lint test.yaml
- Observe that no warning was raised regarding the absent
id
property in the example.
validating /data/docs/events/test.yaml...
/data/docs/events/test.yaml: validated in 8ms
Woohoo! Your API description is valid. 🎉
Expected behavior
All examples should be linted.
Logs
OpenAPI description
Redocly Version(s): 1.9.0
Node.js
Version(s) v21.6.1