Skip to content

Commit f7ddc75

Browse files
authored
CLOUDP-305862 - format of the docs (#533)
1 parent 1e15c6a commit f7ddc75

File tree

4 files changed

+234
-105
lines changed

4 files changed

+234
-105
lines changed

tools/spectral/ipa/__tests__/collectionIdentifierCamelCase.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
4545
{
4646
code: 'xgen-IPA-102-collection-identifier-camelCase',
4747
message:
48-
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources' is not in camelCase. http://go/ipa/102",
48+
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources' is not in camelCase. http://go/ipa-spectral#IPA-102",
4949
path: ['paths', '/Resources'],
5050
severity: DiagnosticSeverity.Warning,
5151
},
@@ -62,7 +62,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
6262
{
6363
code: 'xgen-IPA-102-collection-identifier-camelCase',
6464
message:
65-
"Collection identifiers must be in camelCase. Path segment 'resource_groups' in path '/resource_groups' is not in camelCase. http://go/ipa/102",
65+
"Collection identifiers must be in camelCase. Path segment 'resource_groups' in path '/resource_groups' is not in camelCase. http://go/ipa-spectral#IPA-102",
6666
path: ['paths', '/resource_groups'],
6767
severity: DiagnosticSeverity.Warning,
6868
},
@@ -79,7 +79,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
7979
{
8080
code: 'xgen-IPA-102-collection-identifier-camelCase',
8181
message:
82-
"Collection identifiers must be in camelCase. Path segment 'resource-groups' in path '/resource-groups' is not in camelCase. http://go/ipa/102",
82+
"Collection identifiers must be in camelCase. Path segment 'resource-groups' in path '/resource-groups' is not in camelCase. http://go/ipa-spectral#IPA-102",
8383
path: ['paths', '/resource-groups'],
8484
severity: DiagnosticSeverity.Warning,
8585
},
@@ -96,7 +96,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
9696
{
9797
code: 'xgen-IPA-102-collection-identifier-camelCase',
9898
message:
99-
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources:createResource' is not in camelCase. http://go/ipa/102",
99+
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources:createResource' is not in camelCase. http://go/ipa-spectral#IPA-102",
100100
path: ['paths', '/Resources:createResource'],
101101
severity: DiagnosticSeverity.Warning,
102102
},
@@ -113,7 +113,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
113113
{
114114
code: 'xgen-IPA-102-collection-identifier-camelCase',
115115
message:
116-
"Collection identifiers must be in camelCase. Path segment 'resourcesAPI' in path '/resourcesAPI' is not in camelCase. http://go/ipa/102",
116+
"Collection identifiers must be in camelCase. Path segment 'resourcesAPI' in path '/resourcesAPI' is not in camelCase. http://go/ipa-spectral#IPA-102",
117117
path: ['paths', '/resourcesAPI'],
118118
severity: DiagnosticSeverity.Warning,
119119
},
@@ -145,21 +145,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
145145
{
146146
code: 'xgen-IPA-102-collection-identifier-camelCase',
147147
message:
148-
"Collection identifiers must be in camelCase. Path '/api//users' contains double slashes (//) which is not allowed. http://go/ipa/102",
148+
"Collection identifiers must be in camelCase. Path '/api//users' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
149149
path: ['paths', '/api//users'],
150150
severity: DiagnosticSeverity.Warning,
151151
},
152152
{
153153
code: 'xgen-IPA-102-collection-identifier-camelCase',
154154
message:
155-
"Collection identifiers must be in camelCase. Path '/resources///{resourceId}' contains double slashes (//) which is not allowed. http://go/ipa/102",
155+
"Collection identifiers must be in camelCase. Path '/resources///{resourceId}' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
156156
path: ['paths', '/resources///{resourceId}'],
157157
severity: DiagnosticSeverity.Warning,
158158
},
159159
{
160160
code: 'xgen-IPA-102-collection-identifier-camelCase',
161161
message:
162-
"Collection identifiers must be in camelCase. Path '//doubleSlashAtStart' contains double slashes (//) which is not allowed. http://go/ipa/102",
162+
"Collection identifiers must be in camelCase. Path '//doubleSlashAtStart' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
163163
path: ['paths', '//doubleSlashAtStart'],
164164
severity: DiagnosticSeverity.Warning,
165165
},
@@ -186,21 +186,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
186186
{
187187
code: 'xgen-IPA-102-collection-identifier-camelCase',
188188
message:
189-
"Collection identifiers must be in camelCase. Path segment 'API' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa/102",
189+
"Collection identifiers must be in camelCase. Path segment 'API' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
190190
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
191191
severity: DiagnosticSeverity.Warning,
192192
},
193193
{
194194
code: 'xgen-IPA-102-collection-identifier-camelCase',
195195
message:
196-
"Collection identifiers must be in camelCase. Path segment 'Resource_groups' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa/102",
196+
"Collection identifiers must be in camelCase. Path segment 'Resource_groups' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
197197
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
198198
severity: DiagnosticSeverity.Warning,
199199
},
200200
{
201201
code: 'xgen-IPA-102-collection-identifier-camelCase',
202202
message:
203-
"Collection identifiers must be in camelCase. Path segment 'User-profiles' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa/102",
203+
"Collection identifiers must be in camelCase. Path segment 'User-profiles' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
204204
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
205205
severity: DiagnosticSeverity.Warning,
206206
},
@@ -217,14 +217,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
217217
{
218218
code: 'xgen-IPA-102-collection-identifier-camelCase',
219219
message:
220-
"Collection identifiers must be in camelCase. Path segment 'Valid' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa/102",
220+
"Collection identifiers must be in camelCase. Path segment 'Valid' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa-spectral#IPA-102",
221221
path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'],
222222
severity: DiagnosticSeverity.Warning,
223223
},
224224
{
225225
code: 'xgen-IPA-102-collection-identifier-camelCase',
226226
message:
227-
"Collection identifiers must be in camelCase. Path segment 'Invalid_resource' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa/102",
227+
"Collection identifiers must be in camelCase. Path segment 'Invalid_resource' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa-spectral#IPA-102",
228228
path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'],
229229
severity: DiagnosticSeverity.Warning,
230230
},
@@ -241,14 +241,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
241241
{
242242
code: 'xgen-IPA-102-collection-identifier-camelCase',
243243
message:
244-
"Collection identifiers must be in camelCase. Path '/api//Invalid_segment//resources' contains double slashes (//) which is not allowed. http://go/ipa/102",
244+
"Collection identifiers must be in camelCase. Path '/api//Invalid_segment//resources' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
245245
path: ['paths', '/api//Invalid_segment//resources'],
246246
severity: DiagnosticSeverity.Warning,
247247
},
248248
{
249249
code: 'xgen-IPA-102-collection-identifier-camelCase',
250250
message:
251-
"Collection identifiers must be in camelCase. Path segment 'Invalid_segment' in path '/api//Invalid_segment//resources' is not in camelCase. http://go/ipa/102",
251+
"Collection identifiers must be in camelCase. Path segment 'Invalid_segment' in path '/api//Invalid_segment//resources' is not in camelCase. http://go/ipa-spectral#IPA-102",
252252
path: ['paths', '/api//Invalid_segment//resources'],
253253
severity: DiagnosticSeverity.Warning,
254254
},

tools/spectral/ipa/rulesets/IPA-102.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33

44
rules:
55
xgen-IPA-102-collection-identifier-camelCase:
6-
description: >-
7-
Collection identifiers must be in camelCase. Logic includes:<br/>
8-
- All path segments that are not path parameters<br/>
9-
- Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)<br/>
10-
- Path parameters should also follow camelCase naming<br/>
11-
- Certain values can be exempted via the ignoredValues configuration (e.g., 'v1', 'v2') that can be supplied as `ignoredValues`
12-
argument to the rule<br/>
13-
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation<br/>
14-
- Double slashes (//) are not allowed in paths<br/>
15-
http://go/ipa/102
16-
message: '{{error}} http://go/ipa/102'
6+
description: |
7+
Collection identifiers must be in camelCase.
8+
9+
##### Implementation details
10+
Rule checks for the following conditions:
11+
12+
- All path segments that are not path parameters
13+
- Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)
14+
- Path parameters should also follow camelCase naming
15+
- Certain values can be exempted via the ignoredValues configuration that can be supplied as `ignoredValues`
16+
argument to the rule
17+
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
18+
- Double slashes (//) are not allowed in paths
19+
20+
message: '{{error}} http://go/ipa-spectral#IPA-102'
1721
severity: warn
1822
given: $.paths
1923
then:

0 commit comments

Comments
 (0)