Skip to content

Commit a562bab

Browse files
prettier fix
1 parent 8c45fba commit a562bab

File tree

2 files changed

+69
-59
lines changed

2 files changed

+69
-59
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const componentSchemas = {
1515
},
1616
otherThing: {
1717
type: 'string',
18-
}
18+
},
1919
},
2020
},
2121
SchemaThree: {
@@ -41,7 +41,7 @@ const componentSchemas = {
4141
},
4242
otherThing: {
4343
type: 'string',
44-
}
44+
},
4545
},
4646
},
4747
SchemaCircularOne: {

tools/spectral/ipa/rulesets/README.md

Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,188 +14,198 @@ Rule is based on [http://go/ipa/IPA-5](http://go/ipa/IPA-5).
1414

1515
#### xgen-IPA-005-exception-extension-format
1616

17-
![error](https://img.shields.io/badge/error-red)
17+
![error](https://img.shields.io/badge/error-red)
1818
IPA exception extensions must follow the correct format. http://go/ipa/5
1919

2020
##### Implementation details
21-
Rule checks for the following conditions:
22-
- Exception rule names must start with 'xgen-IPA-' prefix
23-
- Each exception must include a non-empty reason as a string
24-
- This rule itself does not allow exceptions
2521

22+
Rule checks for the following conditions:
2623

24+
- Exception rule names must start with 'xgen-IPA-' prefix
25+
- Each exception must include a non-empty reason as a string
26+
- This rule itself does not allow exceptions
2727

2828
### IPA-102
2929

3030
Rule is based on [http://go/ipa/IPA-102](http://go/ipa/IPA-102).
3131

3232
#### xgen-IPA-102-path-alternate-resource-name-path-param
3333

34-
![error](https://img.shields.io/badge/error-red)
34+
![error](https://img.shields.io/badge/error-red)
3535
Paths should alternate between resource names and path params. http://go/ipa/102
36+
3637
#### xgen-IPA-102-collection-identifier-camelCase
3738

38-
![warn](https://img.shields.io/badge/warning-yellow)
39+
![warn](https://img.shields.io/badge/warning-yellow)
3940
Collection identifiers must be in camelCase.
4041

41-
##### Implementation details
42-
Rule checks for the following conditions:
42+
##### Implementation details
4343

44-
- All path segments that are not path parameters
45-
- Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)
46-
- Path parameters should also follow camelCase naming
47-
- Certain values can be exempted via the ignoredValues configuration that can be supplied as `ignoredValues`
48-
argument to the rule
49-
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
50-
- Double slashes (//) are not allowed in paths
44+
Rule checks for the following conditions:
45+
46+
- All path segments that are not path parameters
47+
- Only the resource identifier part before any colon in custom method paths (e.g., `resource` in `/resource:customMethod`)
48+
- Path parameters should also follow camelCase naming
49+
- Certain values can be exempted via the ignoredValues configuration that can be supplied as `ignoredValues`
50+
argument to the rule
51+
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
52+
- Double slashes (//) are not allowed in paths
5153

5254
#### xgen-IPA-102-collection-identifier-pattern
5355

54-
![warn](https://img.shields.io/badge/warning-yellow)
56+
![warn](https://img.shields.io/badge/warning-yellow)
5557
Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers. http://go/ipa/102
5658

57-
5859
### IPA-104
5960

6061
Rule is based on [http://go/ipa/IPA-104](http://go/ipa/IPA-104).
6162

6263
#### xgen-IPA-104-resource-has-GET
6364

64-
![warn](https://img.shields.io/badge/warning-yellow)
65+
![warn](https://img.shields.io/badge/warning-yellow)
6566
APIs must provide a Get method for resources. http://go/ipa/104
67+
6668
#### xgen-IPA-104-get-method-returns-single-resource
6769

68-
![warn](https://img.shields.io/badge/warning-yellow)
70+
![warn](https://img.shields.io/badge/warning-yellow)
6971
The purpose of the Get method is to return data from a single resource. http://go/ipa/104
72+
7073
#### xgen-IPA-104-get-method-response-code-is-200
7174

72-
![warn](https://img.shields.io/badge/warning-yellow)
75+
![warn](https://img.shields.io/badge/warning-yellow)
7376
The Get method must return a 200 OK response. http://go/ipa/104
77+
7478
#### xgen-IPA-104-get-method-returns-response-suffixed-object
7579

76-
![warn](https://img.shields.io/badge/warning-yellow)
80+
![warn](https://img.shields.io/badge/warning-yellow)
7781
The Get method of a resource should return a "Response" suffixed object. http://go/ipa/104
82+
7883
#### xgen-IPA-104-get-method-response-has-no-input-fields
7984

80-
![warn](https://img.shields.io/badge/warning-yellow)
85+
![warn](https://img.shields.io/badge/warning-yellow)
8186
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
87+
8288
#### xgen-IPA-104-get-method-no-request-body
8389

84-
![warn](https://img.shields.io/badge/warning-yellow)
90+
![warn](https://img.shields.io/badge/warning-yellow)
8591
The Get method request must not include a body. http://go/ipa/104
8692

87-
8893
### IPA-105
8994

9095
Rule is based on [http://go/ipa/IPA-105](http://go/ipa/IPA-105).
9196

9297
#### xgen-IPA-105-list-method-response-code-is-200
9398

94-
![warn](https://img.shields.io/badge/warning-yellow)
99+
![warn](https://img.shields.io/badge/warning-yellow)
95100
The List method must return a 200 OK response. http://go/ipa/105
101+
96102
#### xgen-IPA-105-list-method-no-request-body
97103

98-
![warn](https://img.shields.io/badge/warning-yellow)
104+
![warn](https://img.shields.io/badge/warning-yellow)
99105
The List method request must not include a body. http://go/ipa/105
106+
100107
#### xgen-IPA-105-resource-has-list
101108

102-
![warn](https://img.shields.io/badge/warning-yellow)
109+
![warn](https://img.shields.io/badge/warning-yellow)
103110
APIs must provide a List method for resources. http://go/ipa/105
111+
104112
#### xgen-IPA-105-list-method-response-is-get-method-response
105113

106-
![warn](https://img.shields.io/badge/warning-yellow)
114+
![warn](https://img.shields.io/badge/warning-yellow)
107115
The response body of the List method should consist of the same resource object returned by the Get method. http://go/ipa/105
116+
108117
##### Implementation details
109-
Validation checks that the List method response contains items property with reference to the same schema as the Get method response.
110118

111-
- Validation applies to List methods for resource collections only
112-
- Validation applies to json response content only
113-
- Validation ignores responses without schema and non-paginated responses
114-
- A response is considered paginated if it contains an array property named `results`
115-
- Validation ignores resources without a Get method
116-
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
119+
Validation checks that the List method response contains items property with reference to the same schema as the Get method response.
117120

121+
- Validation applies to List methods for resource collections only
122+
- Validation applies to json response content only
123+
- Validation ignores responses without schema and non-paginated responses
124+
- A response is considered paginated if it contains an array property named `results`
125+
- Validation ignores resources without a Get method
126+
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
118127

119128
### IPA-106
120129

121130
Rule is based on [http://go/ipa/IPA-106](http://go/ipa/IPA-106).
122131

123132
#### xgen-IPA-106-create-method-request-body-is-request-suffixed-object
124133

125-
![warn](https://img.shields.io/badge/warning-yellow)
134+
![warn](https://img.shields.io/badge/warning-yellow)
126135
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.
136+
127137
#### xgen-IPA-106-create-method-should-not-have-query-parameters
128138

129-
![warn](https://img.shields.io/badge/warning-yellow)
139+
![warn](https://img.shields.io/badge/warning-yellow)
130140
Create operations should not use query parameters. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
141+
131142
#### xgen-IPA-106-create-method-request-body-is-get-method-response
132143

133-
![warn](https://img.shields.io/badge/warning-yellow)
134-
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:true properties of Get method response will be ignored. writeOnly:true properties of Create method request will be ignored. This rule applies only to POST requests targeting resource collection URIs.
144+
![warn](https://img.shields.io/badge/warning-yellow)
145+
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:true properties of Get method response will be ignored. writeOnly:true properties of Create method request will be ignored. This rule applies only to POST requests targeting resource collection URIs.
146+
135147
#### xgen-IPA-106-create-method-request-has-no-readonly-fields
136148

137-
![warn](https://img.shields.io/badge/warning-yellow)
149+
![warn](https://img.shields.io/badge/warning-yellow)
138150
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.
151+
139152
#### xgen-IPA-106-create-method-response-code-is-201
140153

141-
![warn](https://img.shields.io/badge/warning-yellow)
154+
![warn](https://img.shields.io/badge/warning-yellow)
142155
Create methods must return a 201 Created response code. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs.
143156

144-
145157
### IPA-108
146158

147159
Rule is based on [http://go/ipa/IPA-108](http://go/ipa/IPA-108).
148160

149161
#### xgen-IPA-108-delete-response-should-be-empty
150162

151-
![warn](https://img.shields.io/badge/warning-yellow)
163+
![warn](https://img.shields.io/badge/warning-yellow)
152164
Delete method response should not have schema reference to object. http://go/ipa/108
165+
153166
#### xgen-IPA-108-delete-method-return-204-response
154167

155-
![warn](https://img.shields.io/badge/warning-yellow)
168+
![warn](https://img.shields.io/badge/warning-yellow)
156169
DELETE method must return 204 No Content. http://go/ipa/108
170+
157171
#### xgen-IPA-108-delete-include-404-response
158172

159-
![warn](https://img.shields.io/badge/warning-yellow)
173+
![warn](https://img.shields.io/badge/warning-yellow)
160174
DELETE method must include 404 response and return it when resource not found. http://go/ipa/108
175+
161176
#### xgen-IPA-108-delete-request-no-body
162177

163-
![warn](https://img.shields.io/badge/warning-yellow)
178+
![warn](https://img.shields.io/badge/warning-yellow)
164179
DELETE method must not have request body. http://go/ipa/108
165180

166-
167181
### IPA-109
168182

169183
Rule is based on [http://go/ipa/IPA-109](http://go/ipa/IPA-109).
170184

171185
#### xgen-IPA-109-custom-method-must-be-GET-or-POST
172186

173-
![error](https://img.shields.io/badge/error-red)
187+
![error](https://img.shields.io/badge/error-red)
174188
The HTTP method for custom methods must be GET or POST. http://go/ipa/109
189+
175190
#### xgen-IPA-109-custom-method-must-use-camel-case
176191

177-
![error](https://img.shields.io/badge/error-red)
192+
![error](https://img.shields.io/badge/error-red)
178193
The custom method must use camelCase format. http://go/ipa/109
179194

180-
181195
### IPA-113
182196

183197
Rule is based on [http://go/ipa/IPA-113](http://go/ipa/IPA-113).
184198

185199
#### xgen-IPA-113-singleton-must-not-have-id
186200

187-
![warn](https://img.shields.io/badge/warning-yellow)
201+
![warn](https://img.shields.io/badge/warning-yellow)
188202
Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113
189203

190-
191204
### IPA-123
192205

193206
Rule is based on [http://go/ipa/IPA-123](http://go/ipa/IPA-123).
194207

195208
#### xgen-IPA-123-enum-values-must-be-upper-snake-case
196209

197-
![error](https://img.shields.io/badge/error-red)
210+
![error](https://img.shields.io/badge/error-red)
198211
Enum values must be UPPER_SNAKE_CASE. http://go/ipa/123
199-
200-
201-

0 commit comments

Comments
 (0)