Skip to content

Commit a526f6d

Browse files
committed
CLOUDP-305862: change format from table to section in markdown
1 parent 936804f commit a526f6d

File tree

3 files changed

+148
-90
lines changed

3 files changed

+148
-90
lines changed

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}} https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/README.md#ipa-102'
1721
severity: warn
1822
given: $.paths
1923
then:

tools/spectral/ipa/rulesets/README.md

Lines changed: 109 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,95 +6,150 @@ All Spectral rules used in the IPA validation are defined in rulesets grouped by
66

77
## Rulesets
88

9-
The tables below lists all available rules, their descriptions and severity level.
9+
Below is a list of all available rules, their descriptions and severity levels.
1010

1111
### IPA-005
1212

13-
For rule definitions, see [IPA-005.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-005.yaml).
13+
Rule is based on [http://go/ipa/IPA-005.yaml](http://go/ipa/IPA-005.yaml).
14+
15+
#### [error]xgen-IPA-005-exception-extension-format
16+
IPA exception extensions must follow the correct format. http://go/ipa/5
17+
1418

15-
| Rule Name | Description | Severity |
16-
| --------------------------------------- | ------------------------------------------------------------------------ | -------- |
17-
| xgen-IPA-005-exception-extension-format | IPA exception extensions must follow the correct format. http://go/ipa/5 | error |
1819

1920
### IPA-102
2021

21-
For rule definitions, see [IPA-102.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-102.yaml).
22+
Rule is based on [http://go/ipa/IPA-102.yaml](http://go/ipa/IPA-102.yaml).
23+
24+
#### [error]xgen-IPA-102-path-alternate-resource-name-path-param
25+
Paths should alternate between resource names and path params. http://go/ipa/102
26+
27+
#### [warn]xgen-IPA-102-collection-identifier-camelCase
28+
Collection identifiers must be in camelCase.
29+
30+
##### Implementation details
31+
Rule checks for the following conditions:
32+
33+
- All path segments that are not path parameters
34+
- Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)
35+
- Path parameters should also follow camelCase naming
36+
- Certain values can be exempted via the ignoredValues configuration that can be supplied as `ignoredValues`
37+
argument to the rule
38+
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
39+
- Double slashes (//) are not allowed in paths
40+
41+
42+
#### [warn]xgen-IPA-102-collection-identifier-pattern
43+
Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers. http://go/ipa/102
44+
2245

23-
| Rule Name | Description | Severity |
24-
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
25-
| xgen-IPA-102-path-alternate-resource-name-path-param | Paths should alternate between resource names and path params. http://go/ipa/102 | error |
26-
| xgen-IPA-102-collection-identifier-camelCase | Collection identifiers must be in camelCase. Logic includes:<br/> - All path segments that are not path parameters<br/> - Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)<br/> - Path parameters should also follow camelCase naming<br/> - Certain values can be exempted via the ignoredValues configuration (e.g., 'v1', 'v2') that can be supplied as `ignoredValues` argument to the rule<br/> - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation<br/> - Double slashes (//) are not allowed in paths<br/> http://go/ipa/102 | warn |
27-
| xgen-IPA-102-collection-identifier-pattern | Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers. http://go/ipa/102 | warn |
2846

2947
### IPA-104
3048

31-
For rule definitions, see [IPA-104.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-104.yaml).
49+
Rule is based on [http://go/ipa/IPA-104.yaml](http://go/ipa/IPA-104.yaml).
50+
51+
#### [warn]xgen-IPA-104-resource-has-GET
52+
APIs must provide a Get method for resources. http://go/ipa/104
53+
54+
#### [warn]xgen-IPA-104-get-method-returns-single-resource
55+
The purpose of the Get method is to return data from a single resource. http://go/ipa/104
56+
57+
#### [warn]xgen-IPA-104-get-method-response-code-is-200
58+
The Get method must return a 200 OK response. http://go/ipa/104
59+
60+
#### [warn]xgen-IPA-104-get-method-returns-response-suffixed-object
61+
The Get method of a resource should return a "Response" suffixed object. http://go/ipa/104
62+
63+
#### [warn]xgen-IPA-104-get-method-response-has-no-input-fields
64+
The Get method response object must not include writeOnly properties (fields that should be used only on creation or update, ie output fields). http://go/ipa/104
65+
66+
#### [warn]xgen-IPA-104-get-method-no-request-body
67+
The Get method request must not include a body. http://go/ipa/104
68+
3269

33-
| Rule Name | Description | Severity |
34-
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
35-
| xgen-IPA-104-resource-has-GET | APIs must provide a Get method for resources. http://go/ipa/104 | warn |
36-
| xgen-IPA-104-get-method-returns-single-resource | The purpose of the Get method is to return data from a single resource. http://go/ipa/104 | warn |
37-
| xgen-IPA-104-get-method-response-code-is-200 | The Get method must return a 200 OK response. http://go/ipa/104 | warn |
38-
| xgen-IPA-104-get-method-returns-response-suffixed-object | The Get method of a resource should return a "Response" suffixed object. http://go/ipa/104 | warn |
39-
| xgen-IPA-104-get-method-response-has-no-input-fields | The Get method response object must not include writeOnly properties (fields that should be used only on creation or update, ie output fields). http://go/ipa/104 | warn |
40-
| xgen-IPA-104-get-method-no-request-body | The Get method request must not include a body. http://go/ipa/104 | warn |
4170

4271
### IPA-105
4372

44-
For rule definitions, see [IPA-105.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-105.yaml).
73+
Rule is based on [http://go/ipa/IPA-105.yaml](http://go/ipa/IPA-105.yaml).
74+
75+
#### [warn]xgen-IPA-105-list-method-response-code-is-200
76+
The List method must return a 200 OK response. http://go/ipa/105
77+
78+
#### [warn]xgen-IPA-105-list-method-no-request-body
79+
The List method request must not include a body. http://go/ipa/105
80+
81+
#### [warn]xgen-IPA-105-resource-has-list
82+
APIs must provide a List method for resources. http://go/ipa/105
83+
4584

46-
| Rule Name | Description | Severity |
47-
| --------------------------------------------- | ------------------------------------------------------------------ | -------- |
48-
| xgen-IPA-105-list-method-response-code-is-200 | The List method must return a 200 OK response. http://go/ipa/105 | warn |
49-
| xgen-IPA-105-list-method-no-request-body | The List method request must not include a body. http://go/ipa/105 | warn |
50-
| xgen-IPA-105-resource-has-list | APIs must provide a List method for resources. http://go/ipa/105 | warn |
5185

5286
### IPA-106
5387

54-
For rule definitions, see [IPA-106.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-106.yaml).
88+
Rule is based on [http://go/ipa/IPA-106.yaml](http://go/ipa/IPA-106.yaml).
89+
90+
#### [warn]xgen-IPA-106-create-method-request-body-is-request-suffixed-object
91+
The Create method request should be a Request suffixed object. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
92+
93+
#### [warn]xgen-IPA-106-create-method-should-not-have-query-parameters
94+
Create operations should not use query parameters. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
95+
96+
#### [warn]xgen-IPA-106-create-method-request-body-is-get-method-response
97+
Request body content of the Create method and response content of the Get method should refer to the same resource. http://go/ipa/106 readOnly/writeOnly properties will be ignored. This rule applies only to POST requests targeting resource collection URIs.
98+
99+
#### [warn]xgen-IPA-106-create-method-request-has-no-readonly-fields
100+
Create method Request object must not include fields with readOnly:true. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
101+
102+
#### [warn]xgen-IPA-106-create-method-response-code-is-201
103+
Create methods must return a 201 Created response code. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
104+
55105

56-
| Rule Name | Description | Severity |
57-
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
58-
| xgen-IPA-106-create-method-request-body-is-request-suffixed-object | The Create method request should be a Request suffixed object. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn |
59-
| xgen-IPA-106-create-method-should-not-have-query-parameters | Create operations should not use query parameters. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn |
60-
| xgen-IPA-106-create-method-request-body-is-get-method-response | Request body content of the Create method and response content of the Get method should refer to the same resource. http://go/ipa/106 readOnly/writeOnly properties will be ignored. This rule applies only to POST requests targeting resource collection URIs. | warn |
61-
| xgen-IPA-106-create-method-request-has-no-readonly-fields | Create method Request object must not include fields with readOnly:true. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn |
62-
| xgen-IPA-106-create-method-response-code-is-201 | Create methods must return a 201 Created response code. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn |
63106

64107
### IPA-108
65108

66-
For rule definitions, see [IPA-108.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-108.yaml).
109+
Rule is based on [http://go/ipa/IPA-108.yaml](http://go/ipa/IPA-108.yaml).
110+
111+
#### [warn]xgen-IPA-108-delete-response-should-be-empty
112+
Delete method response should not have schema reference to object. http://go/ipa/108
113+
114+
#### [warn]xgen-IPA-108-delete-method-return-204-response
115+
DELETE method must return 204 No Content. http://go/ipa/108
116+
117+
#### [warn]xgen-IPA-108-delete-include-404-response
118+
DELETE method must include 404 response and return it when resource not found. http://go/ipa/108
119+
120+
#### [warn]xgen-IPA-108-delete-request-no-body
121+
DELETE method must not have request body. http://go/ipa/108
122+
67123

68-
| Rule Name | Description | Severity |
69-
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------- |
70-
| xgen-IPA-108-delete-response-should-be-empty | Delete method response should not have schema reference to object. http://go/ipa/108 | warn |
71-
| xgen-IPA-108-delete-method-return-204-response | DELETE method must return 204 No Content. http://go/ipa/108 | warn |
72-
| xgen-IPA-108-delete-include-404-response | DELETE method must include 404 response and return it when resource not found. http://go/ipa/108 | warn |
73-
| xgen-IPA-108-delete-request-no-body | DELETE method must not have request body. http://go/ipa/108 | warn |
74124

75125
### IPA-109
76126

77-
For rule definitions, see [IPA-109.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-109.yaml).
127+
Rule is based on [http://go/ipa/IPA-109.yaml](http://go/ipa/IPA-109.yaml).
128+
129+
#### [error]xgen-IPA-109-custom-method-must-be-GET-or-POST
130+
The HTTP method for custom methods must be GET or POST. http://go/ipa/109
131+
132+
#### [error]xgen-IPA-109-custom-method-must-use-camel-case
133+
The custom method must use camelCase format. http://go/ipa/109
134+
78135

79-
| Rule Name | Description | Severity |
80-
| ---------------------------------------------- | ------------------------------------------------------------------------- | -------- |
81-
| xgen-IPA-109-custom-method-must-be-GET-or-POST | The HTTP method for custom methods must be GET or POST. http://go/ipa/109 | error |
82-
| xgen-IPA-109-custom-method-must-use-camel-case | The custom method must use camelCase format. http://go/ipa/109 | error |
83136

84137
### IPA-113
85138

86-
For rule definitions, see [IPA-113.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-113.yaml).
139+
Rule is based on [http://go/ipa/IPA-113.yaml](http://go/ipa/IPA-113.yaml).
140+
141+
#### [warn]xgen-IPA-113-singleton-must-not-have-id
142+
Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113
143+
87144

88-
| Rule Name | Description | Severity |
89-
| --------------------------------------- | ------------------------------------------------------------------------------------------- | -------- |
90-
| xgen-IPA-113-singleton-must-not-have-id | Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113 | warn |
91145

92146
### IPA-123
93147

94-
For rule definitions, see [IPA-123.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-123.yaml).
148+
Rule is based on [http://go/ipa/IPA-123.yaml](http://go/ipa/IPA-123.yaml).
149+
150+
#### [error]xgen-IPA-123-enum-values-must-be-upper-snake-case
151+
Enum values must be UPPER_SNAKE_CASE. http://go/ipa/123
152+
95153

96-
| Rule Name | Description | Severity |
97-
| ------------------------------------------------- | ------------------------------------------------------- | -------- |
98-
| xgen-IPA-123-enum-values-must-be-upper-snake-case | Enum values must be UPPER_SNAKE_CASE. http://go/ipa/123 | error |
99154

100155

0 commit comments

Comments
 (0)