Skip to content

Commit

Permalink
(fix, ir): Fix undiscriminated union examples (#3619)
Browse files Browse the repository at this point in the history
* (fix, ir): Fix undiscriminated union examples

* Update ruby-sdk snapshot

* Edit CONTRIBUTING.md
  • Loading branch information
amckinney authored May 14, 2024
1 parent af3fe3e commit 4027b17
Show file tree
Hide file tree
Showing 262 changed files with 138,369 additions and 64,277 deletions.
50 changes: 27 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To edit the docs, you can modify `docs.yml` or any of the markdown that it refer

To validate that the docs, run:

```
```sh
npm install -g fern-api
fern check
```
Expand All @@ -43,15 +43,15 @@ Fork by clicking [here](https://github.com/fern-api/fern/fork).

**Step 2: Clone your fork and open in VSCode**

```
```sh
git clone <your fork>
cd fern
code .
```

**Step 3: Install dependencies**

```
```sh
yarn
```

Expand Down Expand Up @@ -91,7 +91,7 @@ To build the CLI, run either:

To run the locally-generated CLI, run:

```
```sh
FERN_NO_VERSION_REDIRECTION=true node <path to CLI> <args>
```

Expand Down Expand Up @@ -142,55 +142,59 @@ You can copy the latest migration as a starting point.

## Generator Testing (Seed CLI)

To test our generators we have built a CLI tool called seed.
To test our generators we have built a CLI tool called seed.

Seed handles building the generators from source and running them against all of the
Seed handles building the generators from source and running them against all of the
test definitions that are present in the repository. It also handles running scripts
against the generated code to make sure that all the generated code compiles and
works as intended.
against the generated code to make sure that all the generated code compiles and
works as intended.

To build seed, simply run

To build seed, simply run
```sh
yarn seed:build
```

Each generator has a folder in the top level `seed` directory. For example, the folder
for the typescript sdk generator is `seed/ts-sdk`. This folder contains a config file
for the typescript sdk generator is `seed/ts-sdk`. This folder contains a config file
called `seed.yml` as well as all the generated code for each test case.

To trigger seed tests on a specific generator run

```sh
yarn seed test --generator python-sdk --fixture file-download --skip-scripts
```

You can specify as many fixtures as you want. If you don't specify one, it will
run on all the fields available.
You can specify as many fixtures as you want. If you don't specify one, it will
run on all the fields available.

### Running seed on a custom fixture

It may be valuable to run seed on a particular Fern definition or OpenAPI spec. To do this,
you can use the `seed run` command and point it at the fern folder:
It may be valuable to run seed on a particular Fern definition or OpenAPI spec. To do this,
you can use the `seed run` command and point it at the fern folder:

```sh
yarn seed run --generator ts-sdk --path /Users/jdoe/fern
```

If the fern folder that you are pointing to has multiple APIs, then you must point it at the
specific API that you are looking to generate:
If the fern folder that you are pointing to has multiple APIs, then you must point it at the
specific API that you are looking to generate:

```sh
yarn seed test --generator ts-sdk --path /Users/jdoe/fern/apis/imdb
```

### Running generators from source

By default, seed will build the docker container for the generator and execute the docker. Building a docker
adds extra time to your iteration cycle so we also have a mode to run the generators directly from source. All you
have to do is use the `--local` flag.
By default, seed will build the docker container for the generator and execute the docker. Building a docker
adds extra time to your iteration cycle so we also have a mode to run the generators directly from source. All you
have to do is use the `--local` flag.

For example, to run the TypeScript SDK generator from source, you can:

For example, to run the TypeScript SDK generator from source, you can:
```sh
yarn seed test --generator ts-sdk --fixture imdb --local
```

The local flag will only work if the generator has configured the `local` configuration in its seed.yml.
See [here](https://github.com/fern-api/fern/blob/bf3c28f1c08447e37949ba938f90228c575194d2/seed/ts-sdk/seed.yml#L7-L14).

The local flag will only work if the generator has configured the `local` configuration in its seed.yml.
See [here](https://github.com/fern-api/fern/blob/bf3c28f1c08447e37949ba938f90228c575194d2/seed/ts-sdk/seed.yml#L7-L14).
Loading

0 comments on commit 4027b17

Please sign in to comment.