Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add deprecate warning for the lint-related options #1342

Merged
merged 8 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/gold-cougars-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@redocly/cli": patch
---

Deprecated lint-related options in the `bundle` command. The options are going to be removed in the subsequent releases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's tell users to lint their API descriptions as a separate command, linking to the lint docs

Use the [lint command](https://redocly.com/docs/cli/commands/lint/) separately to lint your APIs before bundling.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ exports[`E2E bundle lint format bundle lint: should be formatted by format: chec
</file>
</checkstyle>

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "format" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

❌ Validation failed with 1 error.
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

exports[`E2E bundle lint format bundle lint: should be formatted by format: codeframe 1`] = `

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "format" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

[1] openapi.yaml:20:11 at #/paths/~1my_post/post/requestBody/content/application~1json

Expected type \`MediaType\` (object) but got \`null\`
Expand Down
46 changes: 28 additions & 18 deletions __tests__/bundle/bundle-lint-format/emptyFormatValue-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@

exports[`E2E bundle lint format bundle lint: no format parameter or empty value should be formatted as codeframe 1`] = `

[1] openapi.yaml:20:11 at #/paths/~1my_post/post/requestBody/content/application~1json

Expected type \`MediaType\` (object) but got \`null\`

18 | requestBody:
19 | content:
20 | application/json:
| ^^^^^^^^^^^^^^^^^
21 |

Error was generated by the spec rule.


❌ Validation failed with 1 error.
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at /tmp/null.yaml <test>ms.
index.ts bundle [apis...]

Bundle definition.

Positionals:
apis [array] [default: []]

Options:
--version Show version number. [boolean]
--help Show help. [boolean]
-o, --output [string]
--ext Bundle file extension.
[choices: "json", "yaml", "yml"]
--skip-preprocessor Ignore certain preprocessors. [array]
--skip-decorator Ignore certain decorators. [array]
-d, --dereferenced Produce a fully dereferenced bundle. [boolean]
-f, --force Produce bundle output even when errors occur.
[boolean]
--config Path to the config file. [string]
--metafile Produce metadata about the bundle [string]
--remove-unused-components Remove unused components.
[boolean] [default: false]
-k, --keep-url-references Keep absolute url references. [boolean]
--lint-config Severity level for config file linting.
[choices: "warn", "error", "off"] [default: "warn"]

Invalid values:
Argument: format, Given: true, Choices: "stylish", "codeframe", "json", "checkstyle"

`;
6 changes: 6 additions & 0 deletions __tests__/bundle/bundle-lint-format/json-format-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ exports[`E2E bundle lint format bundle lint: should be formatted by format: json
"version": "<version>",
"problems": []
}
[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "format" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

❌ Validation failed with 1 error.
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

exports[`E2E bundle lint format bundle lint: no format parameter or empty value should be formatted as codeframe 1`] = `

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

[1] openapi.yaml:20:11 at #/paths/~1my_post/post/requestBody/content/application~1json

Expected type \`MediaType\` (object) but got \`null\`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

exports[`E2E bundle lint format bundle lint: should be formatted by format: stylish 1`] = `

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "format" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

openapi.yaml:
20:11 error spec Expected type \`MediaType\` (object) but got \`null\`

Expand Down
15 changes: 13 additions & 2 deletions __tests__/bundle/info-description-override-error/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
exports[`E2E bundle info-description-override-error 1`] = `

bundling ./main.yaml...
main.yaml:
8:16 error info-description-override Failed to read markdown override file for "info.description".
[1] main.yaml:8:16 at #/info/description

Failed to read markdown override file for "info.description".
ENOENT: no such file or directory, open './test.md'

6 | title: Example OpenAPI 3 definition.
7 | version: 1.0.0
8 | description: some description
| ^^^^^^^^^^^^^^^^
9 | license:
10 | name: Apache 2.0

Error was generated by the info-description-override rule.


❌ Errors encountered while bundling ./main.yaml: bundle not created (use --force to ignore errors).

`;
6 changes: 6 additions & 0 deletions __tests__/bundle/max-problems-argument/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ components:
items:
$ref: '#/components/schemas/Pet'

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "format" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

foo.yaml:
30:11 error spec Property \`header\` is not expected here.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
exports[`E2E bundle operation-description-override-error 1`] = `

bundling ./openapi.yaml...
openapi.yaml:
23:7 error operation-description-override Failed to read markdown override file for operation "updatePet".
[1] openapi.yaml:23:7 at #/paths/~1pet/put/operationId

Failed to read markdown override file for operation "updatePet".
ENOENT: no such file or directory, open './update-pet-operation-description.md'

21 | summary: Update an existing pet
22 | description: ''
23 | operationId: updatePet
| ^^^^^^^^^^^
24 | responses:
25 | '200':

Error was generated by the operation-description-override rule.


❌ Errors encountered while bundling ./openapi.yaml: bundle not created (use --force to ignore errors).

`;
17 changes: 15 additions & 2 deletions __tests__/bundle/tag-description-override-error/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
exports[`E2E bundle tag-description-override-error 1`] = `

bundling ./main.yaml...
main.yaml:
17:5 error tag-description-override Failed to read markdown override file for tag "pet".
[1] main.yaml:17:5 at #/tags/0

Failed to read markdown override file for tag "pet".
ENOENT: no such file or directory, open './pet-tag-description.md'

15 | email: [email protected]
16 | tags:
17 | - name: pet
| ^^^^^^^^^
18 | description: Everything about your Pets
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 | - name: store
20 | description: Access to Petstore orders

Error was generated by the tag-description-override rule.


❌ Errors encountered while bundling ./main.yaml: bundle not created (use --force to ignore errors).

`;
5 changes: 1 addition & 4 deletions __tests__/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,7 @@ describe('E2E', () => {

const entryPoints = getEntrypoints(testPath);

const args = getParams('../../../packages/cli/src/index.ts', 'bundle', [
'--format=stylish',
...entryPoints,
]);
const args = getParams('../../../packages/cli/src/index.ts', 'bundle', [...entryPoints]);

it(file, () => {
const result = getCommandOutput(args, testPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ components:
error_code:
type: number

[WARNING] "lint" option is deprecated and will be removed in a future release.

[1] openapi.yaml:4:1 at #/info

Info object should contain \`license\` field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

exports[`webpack-bundle test bundle-workflows 1`] = `

[WARNING] "extends" option is deprecated and will be removed in a future release.

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at bundle.yaml <test>ms.

Expand Down
4 changes: 4 additions & 0 deletions __tests__/webpack-bundle/bundle/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

exports[`webpack-bundle test bundle check 1`] = `

[WARNING] "lint" option is deprecated and will be removed in a future release.

[WARNING] "max-problems" option is deprecated and will be removed in a future release.

Woohoo! Your API descriptions are valid. 🎉

bundling ./openapi.yaml...
Expand Down
Loading
Loading