From 7554746e13ffe2811d418e4122a9824b2195631d Mon Sep 17 00:00:00 2001 From: Deep Singhvi Date: Mon, 2 Sep 2024 19:19:50 -0400 Subject: [PATCH] fix(cli): allow service base path to be a slash (#4513) --- packages/cli/cli/versions.yml | 14 ++++++++++++++ .../__test__/valid-base-path.test.ts | 8 +------- .../valid-endpoint-path/valid-endpoint-path.ts | 9 +-------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index c870cc82490..803ad1b08a0 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,3 +1,17 @@ +- changelog_entry: + - summary: | + `fern check` allows the service base-path to be a slash. For example, the following + would be valid: + + ```yml + service: + base-path: "/" + ``` + type: fix + created_at: '2024-09-02' + ir_version: 53 + version: 0.40.4 + - changelog_entry: - summary: Now `fern generator upgrade` respects the `--group` flag and only upgrades generators within a particular group. type: fix diff --git a/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/__test__/valid-base-path.test.ts b/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/__test__/valid-base-path.test.ts index aae1d80a040..225e4db6806 100644 --- a/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/__test__/valid-base-path.test.ts +++ b/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/__test__/valid-base-path.test.ts @@ -16,13 +16,7 @@ describe("valid-endpoint-path", () => { const expectedViolations: ValidationViolation[] = [ { - message: 'Path cannot be /. Use "" instead.', - nodePath: ["service", "endpoints", "slash"], - relativeFilepath: RelativeFilePath.of("a.yml"), - severity: "error" - }, - { - message: "Path must be the empty string, or start with a slash.", + message: "Path must start with a slash.", nodePath: ["service", "endpoints", "noLeadingSlash"], relativeFilepath: RelativeFilePath.of("a.yml"), severity: "error" diff --git a/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/valid-endpoint-path.ts b/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/valid-endpoint-path.ts index 6b271451866..4e982055249 100644 --- a/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/valid-endpoint-path.ts +++ b/packages/cli/fern-definition/validator/src/rules/valid-endpoint-path/valid-endpoint-path.ts @@ -15,14 +15,7 @@ export const ValidEndpointPathRule: Rule = { if (!endpoint.path.startsWith("/")) { violations.push({ severity: "error", - message: "Path must be the empty string, or start with a slash." - }); - } - - if (endpoint.path === "/") { - violations.push({ - severity: "error", - message: 'Path cannot be /. Use "" instead.' + message: "Path must start with a slash." }); }