Skip to content

Commit

Permalink
fix: correct python.ts snippet generator for file uploads. (#2071)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyw520 authored Jan 24, 2025
1 parent ac0a20b commit c2d9a2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ The frontend is served at `localhost:3000`. You can configure which docs are loa

### Docs Dev Environment

To run the docs dev environment, make sure vercel is installed:
To run the docs dev environment, first make sure vercel is installed:

- `npm install -g vercel`

Then link vercel to the project:
From the fern-platform repository, link vercel to the Fern project:

- `vercel link --project app.buildwithfern.com`
- When prompted to setup the project, say `yes`
Expand All @@ -92,7 +92,9 @@ Then, run `vercel pull`, which will create `/fern-platform/.vercel/.env.developm
Then, copy that file (creating if necessary) to `/fern-platform/packages/fern-docs/bundle/.env.local`
Finally, to run the dev server, `cd /packages/fern-docs/bundle` and run `pnpm docs:dev`, which should begin running on `localhost:3000`

Optionally, to reroute to a different docs domain, add a `NEXT_PUBLIC_DOCS_DOMAIN` to `.env.local`
To set a dev docs domain, add a `NEXT_PUBLIC_DOCS_DOMAIN` to `.env.local`. For instance:

- `NEXT_PUBLIC_DOCS_DOMAIN=customer.docs.buildwithfern.com`

## Testing in Staging

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ${this.#buildRequests({ json: JSON.stringify(value, undefined, 2) })}`,
if (v.value == null) {
return undefined;
}
return `'${k}': ('${v.value.name}', open('${v.value.name}', 'rb')),`;
return `('${k}', ('${v.value.name}', open('${v.value.name}', 'rb'))),`;
})
.filter(isNonNullish);
const fileArrays = Object.entries(value)
Expand All @@ -60,19 +60,19 @@ ${this.#buildRequests({ json: JSON.stringify(value, undefined, 2) })}`,
)
.map(([k, v]) => {
const fileStrings = v.value.map(
(file) => `('${file.name}', open('${file.name}', 'rb'))`
(file) => `('${k}', ('${file.name}', open('${file.name}', 'rb')))`
);
if (fileStrings.length === 0) {
return;
}
return `'${k}': [${fileStrings.length === 0 ? fileStrings[0] : indentAfter(`\n${fileStrings.join(",\n")},\n`, 2, 0)}],`;
return fileStrings.join(",\n");
})
.filter(isNonNullish);

const fileEntries = [...singleFiles, ...fileArrays].join("\n");
const files =
fileEntries.length > 0
? `{\n${indentAfter(fileEntries, 2)}\n}`
? `[\n${indentAfter(fileEntries, 2)}\n]`
: undefined;

const dataEntries = Object.entries(value)
Expand Down

0 comments on commit c2d9a2b

Please sign in to comment.