Skip to content

Commit 0c9a7f3

Browse files
authored
chore: change rhoas regex (#46)
1 parent 4e156f8 commit 0c9a7f3

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
---
12
name: PR verification and build
2-
33
on:
44
push:
55
branches: [ main ]
@@ -28,8 +28,8 @@ jobs:
2828
- working-directory: ./spectral
2929
run: yarn lint
3030
# Disabled until we have single API passing tests.
31-
# - working-directory: ./spectral
32-
# run: yarn cli-integration-tests
31+
- working-directory: ./spectral
32+
run: yarn cli-integration-tests
3333

3434

3535

spectral/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ 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\/.*\/v.*\/?.*$`.
9696

9797
- The first segment must be `/api`
98-
- The second segment must specify the API version. This can be a major version such as `v1` or a channel-version such as `v1beta`, `v1alpha`.
99-
- All following segments must follow `snake_case` and can only contain alphabetical characters.
98+
- The second segement denotes the service name (e.g. `/api/kafkas_mgmt`)
99+
- 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`.
100+
- 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`)
100101

101102
**Recommended**: Yes
102103
**Severity**: warning

spectral/ruleset.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ functions:
77
rules:
88
openapi-tags: off
99
operation-tags: off
10+
oas3-valid-schema-example: warn
11+
no-$ref-siblings: warn
12+
oas3-valid-media-example: warn
13+
1014

1115
rhoas-external-$ref:
1216
given: "$..['$ref']"
@@ -50,11 +54,11 @@ rules:
5054
severity: warn
5155
description:
5256
OpenAPI paths must start with `/api/`, followed by a version. All paths
53-
must follow camel_case
57+
must follow snake_case
5458
then:
5559
function: pattern
5660
functionOptions:
57-
match: "\/api\/v.*\/.*$"
61+
match: "\/api\/.*\/v.*\/?.*$"
5862
rhoas-response-media-type:
5963
given: "$.paths.*.*.responses.*.content"
6064
description: application/json is the only acceptable content type

0 commit comments

Comments
 (0)