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
1 change: 1 addition & 0 deletions .github/workflows/ci-dynamic-snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ permissions:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
test-typescript:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
compile:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/definitions-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
run:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fix-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
fix-lint:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ permissions:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
detect-release-bump:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-generator-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
PACKAGE_NAME: "@fern-api/generator-cli"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
GITHUB_TOKEN: ${{ secrets.FERN_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-generator-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
PACKAGE_NAME: "@fern-api/generator-migrations"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

permissions:
id-token: write # Required for OIDC
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/sdk-ete-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ on:

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

permissions:
contents: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security-scanning-and-remediation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ on:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
create-dependabot-prs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
setup:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
# Determine which generator to test based on the triggering workflow
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ env:
DOCKER_BUILDKIT: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
setup:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60

jobs:
validate-changelogs:
Expand Down
8 changes: 4 additions & 4 deletions generators/python/src/fern_python/cli/abstract_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def _get_github_workflow_legacy(
"""
if write_unit_tests:
workflow_yaml += """
- name: Install Fern
run: npm install -g fern-api
- name: Install Fern CLI
uses: fern-api/setup-fern-cli@v1
- name: Test
run: fern test --command "poetry run pytest -rP -n auto ."
"""
Expand Down Expand Up @@ -458,8 +458,8 @@ def _get_github_workflow(
"""
if write_unit_tests:
workflow_yaml += """
- name: Install Fern
run: npm install -g fern-api
- name: Install Fern CLI
uses: fern-api/setup-fern-cli@v1
- name: Test
run: fern test --command "poetry run pytest -rP -n auto ."
"""
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"test:debug": "turbo run test:debug --filter=!@fern-api/ete-tests",
"test:update": "turbo run test:update --filter=!@fern-api/ete-tests",
"test:update:dockerless": "turbo run test:update --filter=!@fern-api/ete-tests --filter=!@fern-api/docker-utils",
"test:ete": "pnpm fern-dev:build && pnpm fern-v2-dev:build && pnpm seed:build && pnpm --filter @fern-api/ete-tests test",
"test:ete:update": "pnpm fern-dev:build && pnpm fern-v2-dev:build && pnpm seed:build && pnpm --filter @fern-api/ete-tests test -- -u",
"test:ete": "turbo run dist:cli:dev --filter=@fern-api/cli --filter=@fern-api/cli-v2 && pnpm seed:build && pnpm --filter @fern-api/ete-tests test",
"test:ete:update": "turbo run dist:cli:dev --filter=@fern-api/cli --filter=@fern-api/cli-v2 && pnpm seed:build && pnpm --filter @fern-api/ete-tests test -- -u",
"test:ete:v2": "pnpm fern-v2-dev:build && pnpm --filter @fern-api/ete-tests test -- v2",
"test:ete:v2:update": "pnpm fern-v2-dev:build && pnpm --filter @fern-api/ete-tests test -- -u v2",
"lint:biome": "biome lint --error-on-warnings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ describe("convertSecurityScheme", () => {
const result = convertSecurityScheme(securitySchemeRef, source, mockTaskContext, context);

// Verify the result
expect(result).toBeDefined();
expect(result?.type).toBe("bearer");
if (result?.type === "bearer") {
expect(result.tokenVariableName).toBeUndefined();
expect(result.tokenEnvVar).toBeUndefined();
}
expect.assert(result != null);
expect.assert(result.type === "bearer");
expect(result.tokenVariableName).toBeUndefined();
expect(result.tokenEnvVar).toBeUndefined();
});

it("should throw an error when resolving reference without context", () => {
Expand All @@ -86,11 +84,9 @@ describe("convertSecurityScheme", () => {

const result = convertSecurityScheme(securityScheme, source, mockTaskContext);

expect(result).toBeDefined();
expect(result?.type).toBe("bearer");
if (result?.type === "bearer") {
expect(result.tokenVariableName).toBeUndefined();
expect(result.tokenEnvVar).toBeUndefined();
}
expect.assert(result != null);
expect.assert(result.type === "bearer");
expect(result.tokenVariableName).toBeUndefined();
expect(result.tokenEnvVar).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,13 @@ describe("buildNavigationForDirectory", () => {
slug: "advanced"
});
const firstItem = result[0];
if (firstItem && firstItem.type === "section") {
expect(firstItem.contents).toHaveLength(1);
expect(firstItem.contents[0]).toMatchObject({
type: "page",
title: "Authentication",
slug: "authentication"
});
}
expect.assert(firstItem?.type === "section");
expect(firstItem.contents).toHaveLength(1);
expect(firstItem.contents[0]).toMatchObject({
type: "page",
title: "Authentication",
slug: "authentication"
});
expect(result[1]).toMatchObject({
type: "page",
title: "Getting Started",
Expand Down Expand Up @@ -278,23 +277,21 @@ describe("buildNavigationForDirectory", () => {
slug: "guides"
});
const firstItem = result[0];
if (firstItem && firstItem.type === "section") {
expect(firstItem.contents).toHaveLength(1);
expect(firstItem.contents[0]).toMatchObject({
type: "section",
title: "Advanced",
slug: "advanced"
});
const secondItem = firstItem.contents[0];
if (secondItem && secondItem.type === "section") {
expect(secondItem.contents).toHaveLength(1);
expect(secondItem.contents[0]).toMatchObject({
type: "page",
title: "Authentication",
slug: "authentication"
});
}
}
expect.assert(firstItem?.type === "section");
expect(firstItem.contents).toHaveLength(1);
expect(firstItem.contents[0]).toMatchObject({
type: "section",
title: "Advanced",
slug: "advanced"
});
const secondItem = firstItem.contents[0];
expect.assert(secondItem?.type === "section");
expect(secondItem.contents).toHaveLength(1);
expect(secondItem.contents[0]).toMatchObject({
type: "page",
title: "Authentication",
slug: "authentication"
});
});
});

Expand Down Expand Up @@ -1097,14 +1094,13 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>
slug: "guides",
overviewAbsolutePath: "/test/guides/index.mdx"
});
if (section && section.type === "section") {
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Getting Started",
slug: "getting-started"
});
}
expect.assert(section?.type === "section");
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Getting Started",
slug: "getting-started"
});
});

it("should use index.md as section overview for subdirectories", async () => {
Expand Down Expand Up @@ -1153,13 +1149,12 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>
slug: "guides",
overviewAbsolutePath: "/test/guides/index.md"
});
if (section && section.type === "section") {
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Authentication"
});
}
expect.assert(section?.type === "section");
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Authentication"
});
});

it("should exclude index.mdx from section contents", async () => {
Expand Down Expand Up @@ -1208,13 +1203,12 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>

expect(result).toHaveLength(1);
const section = result[0];
if (section && section.type === "section") {
expect(section.contents).toHaveLength(2);
const titles = section.contents.map((item) => (item.type === "page" ? item.title : ""));
expect(titles).not.toContain("Index");
expect(titles).toContain("Endpoints");
expect(titles).toContain("Errors");
}
expect.assert(section?.type === "section");
expect(section.contents).toHaveLength(2);
const titles = section.contents.map((item) => (item.type === "page" ? item.title : ""));
expect(titles).not.toContain("Index");
expect(titles).toContain("Endpoints");
expect(titles).toContain("Errors");
});

it("should handle nested subdirectories with index.mdx", async () => {
Expand Down Expand Up @@ -1277,22 +1271,20 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>
title: "Guides",
overviewAbsolutePath: "/test/guides/index.mdx"
});
if (guidesSection && guidesSection.type === "section") {
expect(guidesSection.contents).toHaveLength(1);
const advancedSection = guidesSection.contents[0];
expect(advancedSection).toMatchObject({
type: "section",
title: "Advanced",
overviewAbsolutePath: "/test/guides/advanced/index.mdx"
});
if (advancedSection && advancedSection.type === "section") {
expect(advancedSection.contents).toHaveLength(1);
expect(advancedSection.contents[0]).toMatchObject({
type: "page",
title: "Auth"
});
}
}
expect.assert(guidesSection?.type === "section");
expect(guidesSection.contents).toHaveLength(1);
const advancedSection = guidesSection.contents[0];
expect(advancedSection).toMatchObject({
type: "section",
title: "Advanced",
overviewAbsolutePath: "/test/guides/advanced/index.mdx"
});
expect.assert(advancedSection?.type === "section");
expect(advancedSection.contents).toHaveLength(1);
expect(advancedSection.contents[0]).toMatchObject({
type: "page",
title: "Auth"
});
});

it("should handle case-insensitive index file names", async () => {
Expand Down Expand Up @@ -1339,13 +1331,12 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>
type: "section",
overviewAbsolutePath: "/test/guides/INDEX.MDX"
});
if (section && section.type === "section") {
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Page"
});
}
expect.assert(section?.type === "section");
expect(section.contents).toHaveLength(1);
expect(section.contents[0]).toMatchObject({
type: "page",
title: "Page"
});
});

it("should not set overviewAbsolutePath when no index file exists", async () => {
Expand Down Expand Up @@ -1387,9 +1378,8 @@ describe("buildNavigationForDirectory with index.mdx as section overview", () =>
title: "Guides",
overviewAbsolutePath: undefined
});
if (section && section.type === "section") {
expect(section.contents).toHaveLength(1);
}
expect.assert(section?.type === "section");
expect(section.contents).toHaveLength(1);
});
});

Expand Down
Loading
Loading