Skip to content

Commit e29eec9

Browse files
authored
chore: change rhoas regex (#47)
* fix: fixes the regex pattern that APIs are using to pass more * docs: updated docs surrounding the regex pattern for endpoint definitions * refactor: change the severity of rules which fail * test: testing the pipeline * fix: update the regex to suit new format * docs: doc updates reflecting the new regex
1 parent 0c9a7f3 commit e29eec9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spectral/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ info:
9292

9393
### rhoas-path-regexp
9494

95-
All paths must match the specified regular expression: `\/api\/.*\/v.*\/?.*$`.
95+
All paths must match the specified regular expression: `\/api\/([a-z_]*){1,}(\/v[0-9]*(alpha|beta)?)(\/{?[a-z_]*}?){0,}$`.
9696

9797
- The first segment must be `/api`
98-
- The second segement denotes the service name (e.g. `/api/kafkas_mgmt`)
98+
- The second segement denotes the service name (e.g. `/api/kafkas_mgmt`) and may only be `snake_case`.
9999
- The third segment must specify the API version. This can be a major version such as `v1` or a channel-version such as `v1beta`, `v1alpha`.
100100
- All following segments must follow `snake_case` and can only contain alphabetical characters along and underscores but can be repeated (e.g. `/api/kafkas_mgmt/v1/kafkas/{id}/useful_metrics`)
101101

spectral/ruleset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ rules:
5858
then:
5959
function: pattern
6060
functionOptions:
61-
match: "\/api\/.*\/v.*\/?.*$"
61+
match: "\/api\/([a-z_]*){1,}(\/v[0-9]*(alpha|beta)?)(\/{?[a-z_]*}?){0,}$"
6262
rhoas-response-media-type:
6363
given: "$.paths.*.*.responses.*.content"
6464
description: application/json is the only acceptable content type

0 commit comments

Comments
 (0)