Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9716bf9
build: swap jest with vitest
diatrcz Jun 5, 2026
f7f22cd
build: swap jest with vitest
diatrcz Jun 8, 2026
2c3ec6a
chore: swap commonjs to esm ruleset functions
diatrcz Jun 8, 2026
eae27be
build: esm config ruleset rules
diatrcz Jun 11, 2026
55b6b0b
build: esm config ruleset utils
diatrcz Jun 11, 2026
64d718e
build: esm config utilities
diatrcz Jun 11, 2026
3a3241a
build: update utilities
diatrcz Jun 11, 2026
6dc0972
convert to esm validator
diatrcz Jun 11, 2026
b277168
build: config esm ruleset test
diatrcz Jun 11, 2026
8097d1e
test: fix test cases
diatrcz Jun 16, 2026
268c6d6
tmp
diatrcz Jun 18, 2026
0613709
build: replace oas3 for esm
diatrcz Jun 18, 2026
2a8ad82
build: modify imports for esm
diatrcz Jun 18, 2026
758b889
test: modify tests to pass as esm
diatrcz Jun 23, 2026
e2266c4
fix: add linter fix
diatrcz Jun 23, 2026
81a2e99
test: modify tests from commonjs to esm - utilities
diatrcz Jun 23, 2026
702f151
test: migrate tests from commonjs to esm - validator
diatrcz Jun 26, 2026
8932070
chore: add minor fixes to the code
diatrcz Jun 26, 2026
8f51269
docs: update documentation form commonjs to esm
diatrcz Jun 26, 2026
8a0848a
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
c8286b2
chore: add linter fixes
diatrcz Jun 26, 2026
9d09c35
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
e1d9e68
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
d78098a
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
862e795
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
3315d7e
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
41be07b
fix: add minor fixes for build failures
diatrcz Jun 26, 2026
6030224
chore: update utilities
diatrcz Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ colorizeOutput: false
</td>
<td>
<pre>
module.exports = {
export default {
colorizeOutput: false
};
</pre>
Expand Down Expand Up @@ -326,7 +326,7 @@ errorsOnly: true
</td>
<td>
<pre>
module.exports = {
export default {
errorsOnly: true
};
</pre>
Expand Down Expand Up @@ -377,7 +377,7 @@ files:
</td>
<td>
<pre>
module.exports = {
export default {
files: [
'file1.json',
'file2.yaml'
Expand Down Expand Up @@ -436,7 +436,7 @@ ignoreFiles:
</td>
<td>
<pre>
module.exports = {
export default {
ignoreFiles: [
'/my/apis/file1.yml'
]
Expand Down Expand Up @@ -489,7 +489,7 @@ limits:
</td>
<td>
<pre>
module.exports = {
export default {
limits: {
warnings: 25
}
Expand Down Expand Up @@ -542,7 +542,7 @@ logLevels:
</td>
<td>
<pre>
module.exports = {
export default {
logLevels: {
root: 'error',
'ibm-schema-description-exists': 'debug'
Expand Down Expand Up @@ -591,7 +591,7 @@ outputFormat: json
</td>
<td>
<pre>
module.exports = {
export default {
outputFormat: 'json'
};
</pre>
Expand Down Expand Up @@ -647,7 +647,7 @@ ruleset: my-custom-rules.yaml
</td>
<td>
<pre>
module.exports = {
export default {
ruleset: 'my-custom-rules.yaml'
};
</pre>
Expand Down Expand Up @@ -693,7 +693,7 @@ summaryOnly: true
</td>
<td>
<pre>
module.exports = {
export default {
summaryOnly: true
};
</pre>
Expand Down Expand Up @@ -746,7 +746,7 @@ produceQualityScore: true
</td>
<td>
<pre>
module.exports = {
export default {
produceQualityScore: true
};
</pre>
Expand Down Expand Up @@ -798,7 +798,7 @@ markdownReport: true
</td>
<td>
<pre>
module.exports = {
export default {
markdownReport: true
};
</pre>
Expand All @@ -814,13 +814,13 @@ and the [IBM OpenAPI Ruleset package](https://www.npmjs.com/package/@ibm-cloud/o
Here is a simple example of what that might look like:

```js
const ibmOpenapiRuleset = require('@ibm-cloud/openapi-ruleset');
const { Spectral } = require('@stoplight/spectral-core');
import ibmOpenapiRuleset from '@ibm-cloud/openapi-ruleset';
import { Spectral } from '@stoplight/spectral-core';

function async runSpectral(openapiDocument) {
async function runSpectral(openapiDocument) {
const spectral = new Spectral();
spectral.setRuleset(ibmOpenapiRuleset);
results = await spectral.run(openapiDocument);
const results = await spectral.run(openapiDocument);
console.log(results);
}
```
Expand Down
10 changes: 5 additions & 5 deletions docs/ibm-cloud-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,11 @@ For this reason, we must implement our custom ruleset using javascript instead o
Here is our custom ruleset file (`.spectral.js`):

```javascript
const ibmCloudValidationRules = require('@ibm-cloud/openapi-ruleset'); // Note 1
const { propertyCasingConvention } = require('@ibm-cloud/openapi-ruleset/src/functions');
const { schemas } = require('@ibm-cloud/openapi-ruleset-utilities/src/collections');
import ibmCloudValidationRules from '@ibm-cloud/openapi-ruleset'; // Note 1
import { propertyCasingConvention } from '@ibm-cloud/openapi-ruleset/src/functions';
import { schemas } from '@ibm-cloud/openapi-ruleset-utilities/src/collections';

module.exports = {
export default {
extends: ibmCloudValidationRules,
rules: {
'ibm-property-casing-convention': { // Note 2
Expand All @@ -869,7 +869,7 @@ module.exports = {
```
Notes:
1. This custom ruleset extends `@ibm-cloud/openapi-ruleset` and also references the `propertyCasingConvention` function and the
`schemas` JSONPath collection, so we need to import each of these with `require` statements. In addition, be sure to install
`schemas` JSONPath collection, so we need to import each of these with `import` statements. In addition, be sure to install
the `@ibm-cloud/openapi-ruleset` package: `npm install @ibm-cloud/openapi-ruleset`.
2. This custom rule is re-defining (overriding) the `ibm-property-casing-convention` rule from the `@ibm-cloud/openapi-ruleset` package
so we need to use the same rule id (`ibm-property-casing-convention`). Alternatively, we could have used a different rule id of our choosing,
Expand Down
6 changes: 3 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default [
languageOptions: {
globals: {
...globals.node,
...globals.jest,
...globals.vitest,
...globals.mocha,
},
},
Expand All @@ -22,8 +22,8 @@ export default [
...prettier,
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 13,
sourceType: 'commonjs',
ecmaVersion: 2025,
sourceType: 'module',
globals: {
...globals.node,
...globals.es2021,
Expand Down
Loading
Loading