Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/silly-chairs-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---

Fixed an issue where an API alias's root path might be resolved incorrectly for configuration files located outside the root folder.
4 changes: 2 additions & 2 deletions __tests__/bundle/async3/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ operations:
format: email
description: Email of the user

bundling ./simple.yml...
📦 Created a bundle for ./simple.yml at stdout <test>ms.
bundling simple.yml...
📦 Created a bundle for simple.yml at stdout <test>ms.

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/bundle-anchor/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ paths:
foo: TEST
components: {}

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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ components:
$ref: '#/components/schemas/Name'
description: Other name (specific).

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

`;

Expand Down
4 changes: 2 additions & 2 deletions __tests__/bundle/bundle-description-long/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ info:
security: []
components: {}

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

`;

Expand Down
8 changes: 4 additions & 4 deletions __tests__/bundle/bundle-external-value/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ paths:
externalValue: ./external-value.json
components: {}

bundling ./test-success.yaml...
📦 Created a bundle for ./test-success.yaml at stdout <test>ms.
bundling ./test-wrong-examples.yaml...
bundling test-success.yaml...
📦 Created a bundle for test-success.yaml at stdout <test>ms.
bundling test-wrong-examples.yaml...
[1] test-wrong-examples.yaml:27:17 at #/paths/~1/post/requestBody/content/application~1xml/examples/test-wrong-ref

Can't resolve $ref: ENOENT: no such file or directory './__tests__/bundle/bundle-external-value/external-value-bad-path.json'
Expand All @@ -54,6 +54,6 @@ Can't resolve $ref: ENOENT: no such file or directory './__tests__/bundle/bundle
Error was generated by the bundler rule.


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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ securityDefinitions:
name: access_token
type: apiKey

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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ definitions:
ref:
type: string

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at stdout <test>ms.
bundling openapi.yaml...
📦 Created a bundle for openapi.yaml at stdout <test>ms.
🧹 Removed 4 unused components.

`;
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ components:
schema:
type: integer

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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ components:
ref:
type: string

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at stdout <test>ms.
bundling openapi.yaml...
📦 Created a bundle for openapi.yaml at stdout <test>ms.
🧹 Removed 6 unused components.

`;
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ definitions:
ref:
type: string

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at stdout <test>ms.
bundling openapi.yaml...
📦 Created a bundle for openapi.yaml at stdout <test>ms.
🧹 Removed 4 unused components.

`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ components:
ref:
type: string

bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at stdout <test>ms.
bundling openapi.yaml...
📦 Created a bundle for openapi.yaml at stdout <test>ms.
🧹 Removed 6 unused components.

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/discriminator-mapping/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ components:
bar:
type: boolean

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

`;

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

exports[`E2E bundle info-description-override-error 1`] = `

bundling ./main.yaml...
bundling main.yaml...
[1] main.yaml:8:16 at #/info/description

Failed to read markdown override file for "info.description".
Expand All @@ -18,6 +18,6 @@ ENOENT: no such file or directory, open './test.md'
Error was generated by the info-description-override rule.


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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/info-description-override/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ paths:
description: example description
components: {}

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/info-override/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ paths:
description: example description
components: {}

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/no-duplicated-components/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ components:
Test:
type: object

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/no-self-referenced-components/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ components:
schema:
type: string

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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ components:
myObject.v2.schema:
type: object

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/oas3_1-pattern-porperties/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ components:
object:
type: object

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

`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`E2E bundle operation-description-override-error 1`] = `

bundling ./openapi.yaml...
bundling openapi.yaml...
[1] openapi.yaml:23:7 at #/paths/~1pet/put/operationId

Failed to read markdown override file for operation "updatePet".
Expand All @@ -18,6 +18,6 @@ ENOENT: no such file or directory, open './update-pet-operation-description.md'
Error was generated by the operation-description-override rule.


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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/operation-description-override/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ paths:
description: ok
components: {}

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/primitive-types/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ paths:
key2: 2
components: {}

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/reference-ending-in-hash/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ components:
schemas:
Pet: {}

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/remove-x-internal/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ components:
enum:
- cranberry

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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/resolve-refs-from-x-attributes/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ info:
components: {}

Deprecated plugin format detected: plugin
bundling ./openapi.yaml...
📦 Created a bundle for ./openapi.yaml at stdout <test>ms.
bundling openapi.yaml...
📦 Created a bundle for openapi.yaml at stdout <test>ms.

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/tag-description-override-error/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`E2E bundle tag-description-override-error 1`] = `

bundling ./main.yaml...
bundling main.yaml...
[1] main.yaml:17:5 at #/tags/0

Failed to read markdown override file for tag "pet".
Expand All @@ -20,6 +20,6 @@ ENOENT: no such file or directory, open './pet-tag-description.md'
Error was generated by the tag-description-override rule.


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

`;
4 changes: 2 additions & 2 deletions __tests__/bundle/tag-description-override/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ paths:
description: example description
components: {}

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

`;
19 changes: 19 additions & 0 deletions __tests__/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,25 @@ describe('E2E', () => {
const result = getCommandOutput(args, testPath);
(<any>expect(cleanupOutput(result))).toMatchSpecificSnapshot(join(testPath, 'snapshot.js'));
});

test('apply a decorator to a specific api (without specifying the api)', () => {
const testPath = join(folderPath, 'apply-per-api-decorators');
const args = getParams('../../../packages/cli/src/index.ts', 'bundle', [
'--config=nested/redocly.yaml',
]);
const result = getCommandOutput(args, testPath);
(<any>expect(cleanupOutput(result))).toMatchSpecificSnapshot(join(testPath, 'snapshot.js'));
});

test('apply a decorator to a specific api (when the api is specified as an alias)', () => {
const testPath = join(folderPath, 'apply-per-api-decorators');
const args = getParams('../../../packages/cli/src/index.ts', 'bundle', [
'--config=nested/redocly.yaml',
'test@v1',
]);
const result = getCommandOutput(args, testPath);
(<any>expect(cleanupOutput(result))).toMatchSpecificSnapshot(join(testPath, 'snapshot.js'));
});
});

describe('build-docs', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`E2E lint assertion-string-property-min-length 1`] = `

validating /openapi.yaml...
validating openapi.yaml...
[1] openapi.yaml:31:17 at #/paths/~1pet~1findByStatus/get/responses/200/content/application~1json/schema

rule/minLength failed because the Schema didn't meet the assertions: Required property minLength inside a string property
Expand Down Expand Up @@ -39,7 +39,7 @@ rule/minLength failed because the Schema didn't meet the assertions: Required pr
Error was generated by the rule/minLength rule.


/openapi.yaml: validated in <test>ms
openapi.yaml: validated in <test>ms

❌ Validation failed with 2 errors.
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.
Expand Down
4 changes: 2 additions & 2 deletions __tests__/lint/assertions-camel-case-twice/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`E2E lint assertions-camel-case-twice 1`] = `

validating /openapi.yaml...
validating openapi.yaml...
[1] openapi.yaml:26:5 at #/components/parameters/header_roleCode

Parameters must use camelCase
Expand Down Expand Up @@ -31,7 +31,7 @@ Parameters must use camelCase
Warning was generated by the rule/named-parameters-camelCase rule.


/openapi.yaml: validated in <test>ms
openapi.yaml: validated in <test>ms

Woohoo! Your API description is valid. 🎉
You have 2 warnings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`E2E lint assertions-casing-camel-case-error 1`] = `

validating /openapi.yaml...
validating openapi.yaml...
[1] openapi.yaml:19:20 at #/paths/~1pet~1findByStatus/get/operationId

Operation id for get operation should be camelCase
Expand Down Expand Up @@ -59,7 +59,7 @@ Named Parameters should be camelCase
Error was generated by the rule/camel-case-on-value rule.


/openapi.yaml: validated in <test>ms
openapi.yaml: validated in <test>ms

❌ Validation failed with 4 errors.
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.
Expand Down
Loading
Loading