Skip to content

Commit

Permalink
[OAS][DOCS] Adds linting rule for missing property descriptions (#191594
Browse files Browse the repository at this point in the history
)

## Summary

Resolves elastic/docs-projects#237 by adding a
custom linting rule for missing property descriptions.

---------

Co-authored-by: lcawl <[email protected]>
  • Loading branch information
natasha-moore-elastic and lcawl authored Aug 29, 2024
1 parent 78e6d16 commit 9babac0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions oas_docs/.spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
4 changes: 4 additions & 0 deletions oas_docs/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9babac0

Please sign in to comment.