[OAS][DOCS] Adds linting rule for missing property descriptions (#191594)

## Summary

Resolves https://github.com/elastic/docs-projects/issues/237 by adding a
custom linting rule for missing property descriptions.

---------

Co-authored-by: lcawl <lcawley@elastic.co>
This commit is contained in:
natasha-moore-elastic 2024-08-29 09:44:29 +01:00 committed by GitHub
parent 78e6d16e1c
commit 9babac00ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -47,6 +47,14 @@ rules:
function: pattern
functionOptions:
notMatch: /(blacklist|whitelist|execute|kill)/i
property-description:
description: Properties should have descriptions.
message: "Each property should have a description"
severity: warn
given: $.components.schemas.*.properties.*
then:
field: description
function: defined
# Examples
operation-success-examples:
formats: ['oas3_1']

View file

@ -35,6 +35,10 @@ api-docs-serverless: ## Generate only kibana.serverless.yaml
api-docs-lint: ## Run spectral API docs linter
@npx @stoplight/spectral-cli lint "output/*.yaml" --ruleset ".spectral.yaml"
.PHONY: api-docs-lint-errs
api-docs-lint-errs: ## Run spectral API docs linter and return only errors
@npx @stoplight/spectral-cli lint "output/*.yaml" --ruleset ".spectral.yaml" -D
.PHONY: api-docs-lint-stateful
api-docs-lint-stateful: ## Run spectral API docs linter on kibana.yaml
@npx @stoplight/spectral-cli lint "output/kibana.yaml" --ruleset ".spectral.yaml"