From 89a6a677ef78e7f5e28d92d03048709a8ef0b89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ro=C5=BCek?= Date: Wed, 5 Jul 2023 18:17:54 +0200 Subject: [PATCH 1/3] fix(ruleset-migrator): correct package.json's browser field (#2497) --- packages/ruleset-migrator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ruleset-migrator/package.json b/packages/ruleset-migrator/package.json index 99d89c6c7..9c82b7078 100644 --- a/packages/ruleset-migrator/package.json +++ b/packages/ruleset-migrator/package.json @@ -14,7 +14,7 @@ "/dist" ], "browser": { - "./dist/require-resolve.js": false + "./dist/requireResolve.js": false }, "repository": { "type": "git", From f7512e5ae6c26c8f0ba8fb96d0759645ed9cb7be Mon Sep 17 00:00:00 2001 From: stoplight-bot Date: Thu, 6 Jul 2023 09:22:35 +0000 Subject: [PATCH 2/3] chore(release): 1.9.4 [skip ci] ## @stoplight/spectral-ruleset-migrator [1.9.4](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.9.3...@stoplight/spectral-ruleset-migrator-1.9.4) (2023-07-06) ### Bug Fixes * **ruleset-migrator:** correct package.json's browser field ([#2497](https://github.com/stoplightio/spectral/issues/2497)) ([89a6a67](https://github.com/stoplightio/spectral/commit/89a6a677ef78e7f5e28d92d03048709a8ef0b89b)) --- packages/ruleset-migrator/CHANGELOG.md | 7 +++++++ packages/ruleset-migrator/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/ruleset-migrator/CHANGELOG.md b/packages/ruleset-migrator/CHANGELOG.md index bea2e694f..4250f7e16 100644 --- a/packages/ruleset-migrator/CHANGELOG.md +++ b/packages/ruleset-migrator/CHANGELOG.md @@ -1,3 +1,10 @@ +## @stoplight/spectral-ruleset-migrator [1.9.4](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.9.3...@stoplight/spectral-ruleset-migrator-1.9.4) (2023-07-06) + + +### Bug Fixes + +* **ruleset-migrator:** correct package.json's browser field ([#2497](https://github.com/stoplightio/spectral/issues/2497)) ([89a6a67](https://github.com/stoplightio/spectral/commit/89a6a677ef78e7f5e28d92d03048709a8ef0b89b)) + # [@stoplight/spectral-ruleset-migrator-v1.9.3](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.9.2...@stoplight/spectral-ruleset-migrator-v1.9.3) (2023-04-21) diff --git a/packages/ruleset-migrator/package.json b/packages/ruleset-migrator/package.json index 9c82b7078..cd2a9abfd 100644 --- a/packages/ruleset-migrator/package.json +++ b/packages/ruleset-migrator/package.json @@ -1,6 +1,6 @@ { "name": "@stoplight/spectral-ruleset-migrator", - "version": "1.9.3", + "version": "1.9.4", "homepage": "https://github.com/stoplightio/spectral", "bugs": "https://github.com/stoplightio/spectral/issues", "author": "Stoplight ", From ed6e1dcbcf560023edc8bd2500a038223858e18d Mon Sep 17 00:00:00 2001 From: Nauman Date: Thu, 6 Jul 2023 19:36:35 +0500 Subject: [PATCH 3/3] docs(repo): adds json formatter docs (#2481) --- docs/guides/2-cli.md | 105 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/docs/guides/2-cli.md b/docs/guides/2-cli.md index 120a0f499..f38944c80 100644 --- a/docs/guides/2-cli.md +++ b/docs/guides/2-cli.md @@ -70,6 +70,111 @@ The default behavior can be modified with the `--fail-severity=` option. Setting Changing the fail severity wont' affect output. To change the results Spectral CLI prints to the screen, add the `--display-only-failures` switch (or just `-D` for short). This removes any results which are below the specified fail severity. +## Formatters + +### JSON Formatter + +Spectral's JSON formatter outputs the results of a Spectral analysis in a JSON format that is easily parsable and human-readable. The output can be used to programmatically access and process the results of the analysis. You can enable this by adding `-f json --quiet` to the cli command. + +Here's the schema for the output: + + + +```yaml json_schema +type: array +items: + type: object + properties: + code: + type: string + description: A string that represents the rule code that has been violated or triggered in Spectral. This code is unique to each rule defined in Spectral. + path: + type: array + description: An array of strings that indicate the location within the analyzed document where the rule was triggered. It shows the "path" in the document structure to the issue. + items: + type: string + message: + type: string + description: A string that contains a human-readable message describing the issue found by Spectral. This message typically provides information on why the rule was triggered and how to fix the issue. + severity: + enum: + - 0 + - 1 + - 2 + - 3 + description: An integer representing the severity level of the rule violation. The severity levels usually follow a specific scale defined by Spectral. 0 equals error, while 3 is hint. + range: + type: object + description: An object that describes where in the file the issue was found. It contains two sub-properties, start and end, each of which is an object with line and character properties. line and character are integers that represent the line number and the character position within the line, respectively, where the issue starts or ends. All the values are zero indexed. + properties: + start: + type: object + properties: + line: + type: integer + minimum: 0 + character: + type: integer + minimum: 0 + required: + - line + - character + end: + type: object + properties: + line: + type: integer + minimum: 0 + character: + type: integer + minimum: 0 + required: + - line + - character + source: + type: string + description: A string that contains the file path of the document that was analyzed by Spectral. It points to the source of the issue. + required: + - code + - path + - message + - severity + - range + - source +``` + + + +```json +[ + { + "code": "invalid-response", + "path": ["paths", "/users/{id}", "get", "responses", "200"], + "message": "The '200' response should include a schema definition.", + "severity": 2, + "range": { + "start": { + "line": 32, + "character": 12 + }, + "end": { + "line": 35, + "character": 14 + } + }, + "source": "/Users/johndoe/projects/api-definition/openapi.yaml" + } +] +``` + + + ## Proxying To have requests made from Spectral be proxied through a server, you'd need to specify the `PROXY` environment variable: