@luxass/spectral-ruleset 0.0.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,76 @@ You can also use it directly from unpkg:
35
35
  echo 'extends: ["https://unpkg.com/@luxass/spectral-ruleset"]' > .spectral.yml
36
36
  ```
37
37
 
38
+ ## Rules
39
+
40
+ This ruleset extends the official OpenAPI and AsyncAPI rulesets from `@stoplight/spectral-rulesets`, with some built-in rules modified (`operation-tags` and `operation-operationId` are disabled, `operation-success-response` is set to error level).
41
+
42
+ ### Custom Rules
43
+
44
+ <details>
45
+ <summary><strong>General Rules</strong></summary>
46
+
47
+ ##### `luxass/api-homepage` ⚠️
48
+ Ensures that APIs have a root path (`/`) defined. This helps with API discoverability and provides a clear entry point for consumers.
49
+
50
+ ##### `luxass/api-homepage-get` ⚠️
51
+ Ensures that the API root path (`/`) has a GET operation defined. This allows consumers to discover what the API offers.
52
+
53
+ ##### `luxass/version-in-info` ⚠️
54
+ Enforces semantic versioning format for the `info.version` field (e.g., `1.0.0`).
55
+
56
+ </details>
57
+
58
+ <details>
59
+ <summary><strong>Path Rules</strong></summary>
60
+
61
+ ##### `luxass/paths-kebab-case` ⚠️
62
+ Enforces kebab-case naming convention for all API paths (e.g., `/user-profiles` instead of `/userProfiles`).
63
+
64
+ ##### `luxass/no-file-extensions-in-paths` ❌
65
+ Prevents file extensions (`.json`, `.xml`, `.html`, `.txt`) in API paths. Use the `content` field to specify media types instead.
66
+
67
+ ##### `luxass/no-trailing-slash` ⚠️
68
+ Prevents trailing slashes in paths (except for the root path `/`), avoiding confusion about resource identity.
69
+
70
+ ##### `luxass/plural-resource-names` ⚠️
71
+ Encourages using plural nouns for resource collections (e.g., `/users` instead of `/user`).
72
+
73
+ </details>
74
+
75
+ <details>
76
+ <summary><strong>Header Rules</strong></summary>
77
+
78
+ ##### `luxass/no-x-headers` ❌
79
+ Prevents usage of headers starting with `X-` prefix. Encourages using standardized headers instead of the deprecated X- convention.
80
+
81
+ ##### `luxass/headers-hyphenated-pascal-case` ❌
82
+ Enforces `Hyphenated-Pascal-Case` notation for HTTP headers (e.g., `Content-Type`, `Accept-Language`).
83
+
84
+ </details>
85
+
86
+ <details>
87
+ <summary><strong>OpenAPI 2.0 Specific Rules</strong></summary>
88
+
89
+ ##### `luxass/oas2/protocol-https-only` ❌
90
+ Ensures that only HTTPS protocol is used in the `schemes` array.
91
+
92
+ ##### `luxass/oas2/get-request-no-body` ❌
93
+ Prevents GET requests from having request bodies, following HTTP best practices.
94
+
95
+ </details>
96
+
97
+ <details>
98
+ <summary><strong>OpenAPI 3.x Specific Rules</strong></summary>
99
+
100
+ ##### `luxass/oas3/protocol-https-only` ❌
101
+ Ensures that all server URLs use HTTPS protocol only.
102
+
103
+ ##### `luxass/oas3/get-request-no-body` ❌
104
+ Prevents GET requests from having `requestBody` defined, following HTTP best practices.
105
+
106
+ </details>
107
+
38
108
  ## 📄 License
39
109
 
40
110
  Published under [MIT License](./LICENSE).
package/dist/ruleset.cjs CHANGED
@@ -283,6 +283,16 @@ var ruleset_default = {
283
283
  functionOptions: { match: "^[A-Z][a-z0-9]*(-[A-Z][a-z0-9]*)*$" }
284
284
  }
285
285
  },
286
+ "luxass/version-in-info": {
287
+ message: "API version should follow semantic versioning.",
288
+ description: "The info.version field should follow semantic versioning (e.g., 1.0.0).",
289
+ given: "$.info.version",
290
+ then: {
291
+ function: __stoplight_spectral_functions.pattern,
292
+ functionOptions: { match: "^\\d+\\.\\d+\\.\\d+" }
293
+ },
294
+ severity: DiagnosticSeverity.Warning
295
+ },
286
296
  ...oas2_default,
287
297
  ...oas3_default
288
298
  }
package/dist/ruleset.js CHANGED
@@ -259,6 +259,16 @@ var ruleset_default = {
259
259
  functionOptions: { match: "^[A-Z][a-z0-9]*(-[A-Z][a-z0-9]*)*$" }
260
260
  }
261
261
  },
262
+ "luxass/version-in-info": {
263
+ message: "API version should follow semantic versioning.",
264
+ description: "The info.version field should follow semantic versioning (e.g., 1.0.0).",
265
+ given: "$.info.version",
266
+ then: {
267
+ function: pattern,
268
+ functionOptions: { match: "^\\d+\\.\\d+\\.\\d+" }
269
+ },
270
+ severity: DiagnosticSeverity.Warning
271
+ },
262
272
  ...oas2_default,
263
273
  ...oas3_default
264
274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/spectral-ruleset",
3
- "version": "0.0.5",
3
+ "version": "1.0.0",
4
4
  "description": "Opinonated ruleset for Spectral",
5
5
  "type": "module",
6
6
  "repository": {