Skip to content

Commit

Permalink
feat(cli): change init workspace to incl generators.yml yaml lang ser…
Browse files Browse the repository at this point in the history
…ver (#5282)

* feat(cli): change init behavior to include yaml lang server for generators.yml

---------

Co-authored-by: Niels Swimberghe <[email protected]>
Co-authored-by: fern-support <[email protected]>
  • Loading branch information
3 people authored Jan 12, 2025
1 parent 0a79ceb commit fe06509
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 32 deletions.
6 changes: 3 additions & 3 deletions fern/pages/changelogs/cli/2025-01-03.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## 0.46.18
**`(fix):`** If an object or request is annotated with `extra-properties: true` then the user can provide an example that includes
extra properties that are no longer in the schema.
extra properties that are no longer in the schema.

For example, check out this fern definition
For example, check out this fern definition

```yml service.yml
types:
Item:
Item:
extra-properties: true
properties:
id: string
Expand Down
6 changes: 3 additions & 3 deletions fern/pages/changelogs/cli/2025-01-05.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.46.20
**`(feat):`** The `fern init` command now supports a `--mintlify` option. You can pass in
the path to your `mint.json` and the Fern CLI will generate a fern documentation
website.
**`(feat):`** The `fern init` command now supports a `--mintlify` option. You can pass in
the path to your `mint.json` and the Fern CLI will generate a fern documentation
website.


6 changes: 3 additions & 3 deletions fern/pages/changelogs/cli/2025-01-10.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 0.47.2
**`(feat):`** The CLI now supports checking for broken links in your docs. You will see warnings in `fern check` if your docs link to any
page that can't be resolved, and the `--strict-broken-links` option will cause the command to fail (exit with a non-zero exit code) if
any broken links are found. You can also run the new command `fern docs broken-links` to only check for broken links (ignoring
**`(feat):`** The CLI now supports checking for broken links in your docs. You will see warnings in `fern check` if your docs link to any
page that can't be resolved, and the `--strict-broken-links` option will cause the command to fail (exit with a non-zero exit code) if
any broken links are found. You can also run the new command `fern docs broken-links` to only check for broken links (ignoring
other possible errors), with the `--strict` option to cause the command to fail if any broken links are found.


4 changes: 4 additions & 0 deletions fern/pages/changelogs/cli/2025-01-12.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 0.47.3
**`(feat):`** Add the JSON schema to the generators.yml file for validation and autocomplete.


Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export async function addGeneratorToWorkspaces({
return;
}

await writeFile(absolutePathToGeneratorsConfiguration, yaml.dump(newConfiguration));
await writeFile(
absolutePathToGeneratorsConfiguration,
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" +
yaml.dump(newConfiguration)
);
context.logger.info(chalk.green(`Added ${generatorName} generator`));
});
})
Expand Down
41 changes: 24 additions & 17 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
- changelogEntry:
- summary: |
The CLI now supports checking for broken links in your docs. You will see warnings in `fern check` if your docs link to any
page that can't be resolved, and the `--strict-broken-links` option will cause the command to fail (exit with a non-zero exit code) if
any broken links are found. You can also run the new command `fern docs broken-links` to only check for broken links (ignoring
Add the JSON schema to the generators.yml file for validation and autocomplete.
type: feat
irVersion: 53
version: 0.47.3

- changelogEntry:
- summary: |
The CLI now supports checking for broken links in your docs. You will see warnings in `fern check` if your docs link to any
page that can't be resolved, and the `--strict-broken-links` option will cause the command to fail (exit with a non-zero exit code) if
any broken links are found. You can also run the new command `fern docs broken-links` to only check for broken links (ignoring
other possible errors), with the `--strict` option to cause the command to fail if any broken links are found.
type: feat
irVersion: 53
version: 0.47.2

- changelogEntry:
- summary: |
Fixes a bug where the OpenAPI parser stopped respecting the =`unions: v1` setting in your `generators.yml` which configures the parser to generate more
idiomatic discriminated unions.
Fixes a bug where the OpenAPI parser stopped respecting the =`unions: v1` setting in your `generators.yml` which configures the parser to generate more
idiomatic discriminated unions.
```yml
api:
specs:
Expand Down Expand Up @@ -44,41 +51,41 @@
type: feat
irVersion: 53
version: 0.46.22
- changelogEntry:

- changelogEntry:
- summary: |
The CLI now supports the `prefer-undiscriminated-unions-with-literals` setting in OpenAPI settings.
type: fix
irVersion: 53
version: 0.46.21

- changelogEntry:
- changelogEntry:
- summary: |
The `fern init` command now supports a `--mintlify` option. You can pass in
the path to your `mint.json` and the Fern CLI will generate a fern documentation
website.
The `fern init` command now supports a `--mintlify` option. You can pass in
the path to your `mint.json` and the Fern CLI will generate a fern documentation
website.
type: feat
irVersion: 53
version: 0.46.20

- changelogEntry:
- summary: |
If a schema in OpenAPI or AsyncAPI has `additionalProperties: true` then the Fern CLI will now respect bringing in
example properties that are not defined in the schema. Previously, the CLI would skip them.
If a schema in OpenAPI or AsyncAPI has `additionalProperties: true` then the Fern CLI will now respect bringing in
example properties that are not defined in the schema. Previously, the CLI would skip them.
type: fix
irVersion: 53
version: 0.46.19

- changelogEntry:
- summary: |
If an object or request is annotated with `extra-properties: true` then the user can provide an example that includes
extra properties that are no longer in the schema.
extra properties that are no longer in the schema.
For example, check out this fern definition
For example, check out this fern definition
```yml service.yml
types:
Item:
Item:
extra-properties: true
properties:
id: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ errors:
"type": "file",
},
{
"contents": "default-group: local
"contents": "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
default-group: local
groups:
local:
generators:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ colors:
"type": "file",
},
{
"contents": "default-group: local
"contents": "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
default-group: local
groups:
local:
generators:
Expand Down Expand Up @@ -186,7 +187,8 @@ exports[`fern init > init openapi 1`] = `
"type": "file",
},
{
"contents": "default-group: local
"contents": "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
default-group: local
groups:
local:
generators:
Expand Down Expand Up @@ -422,7 +424,8 @@ errors:
"type": "file",
},
{
"contents": "default-group: local
"contents": "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
default-group: local
groups:
local:
generators:
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/init/src/createWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ async function writeGeneratorsConfiguration({
}): Promise<void> {
await writeFile(
filepath,
yaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context, apiConfiguration }))
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" +
yaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context, apiConfiguration }))
);
}

Expand Down

0 comments on commit fe06509

Please sign in to comment.