-
Notifications
You must be signed in to change notification settings - Fork 2
🌿 Fern Scribe: Update readme and global header documentation. mak... #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
specified), Fern generates an SDK that accepts this as a constructor parameter. | ||
Users can then provide the value once, and the generated SDK automatically | ||
includes the header in all their API calls: | ||
1. Via the OpenAPI specification using extensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, the doc was split between Fern Definition and OpenAPI. The slack thread clarified that they are actually two ways of setting global headers for OpenAPI. I'd expect Fern Scribe to expand the OpenAPI section to add the second option. Instead, it deleted the Fern Definition info and just said there are two ways to do global headers with OpenAPI:(
|
||
To customize the README for your generated SDKs, you can specify a custom template in your `generators.yml` file: | ||
|
||
<CodeBlock title="generators.yml"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine overall but rather long, especially the template variables section. I was hoping it would point to the existing reference documentation but it did not.
title: "Customizing SDK READMEs" | ||
description: "Learn how to customize the README.md files generated for your SDKs" | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created two new files:( Definitely overkill, a better option would be to make one new file and point to the existing reference documentation.
@@ -2,7 +2,6 @@ | |||
title: generators.yml Configuration Schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wayyy too many edits to this document, and edits aren't even restricted to the headers and readme sections (already very defined)
slug: custom-code | ||
- changelog: ./overview/go/changelog | ||
slug: changelog | ||
# - link: Customer Showcase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting lines that aren't at all related to the topic...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I found that this draft was too messy and random to even make a good starting point. I found it easier to start from scratch myself than try to edit this.
My own resulting PR for this topic: #325
🌿 Fern Scribe Documentation Update
Original Request: Update readme and global header documentation. make a new page in the deep dives section for readme and link to the reference documentation
Files Updated:
fern/products/sdks/pages/reference/readme.mdx
fern/products/sdks/sdks.yml
fern/products/sdks/pages/deep-dives/readme.mdx
fern/products/sdks/sdks.yml
fern/products/sdks/reference/generators-yml-reference.mdx
fern/products/sdks/guides/configure-global-headers.mdx
fern/products/sdks/sdks.yml
Priority: Medium
Related Discussion: https://buildwithfern.slack.com/archives/C08T7EHDHMW/p1754058964789879
Additional Context: No response
The following files could not be updated due to MDX validation failures after 3 attempts:
1.
/learn/openapi-definition/extensions/others
(Other)Suggested Content (needs manual MDX fixes):
Global headers
Global headers can be configured in two ways:
x-fern-global-headers
generators.yml
configurationOpenAPI Specification Method
To configure global headers in your OpenAPI spec, use the
x-fern-global-headers
extension:generators.yml Method
You can also specify global headers in your
generators.yml
:The generated client will expose these headers in its constructor:
Fern will automatically detect headers used across multiple endpoints and mark them as global. You can override or add to these using either method above.
For more detailed information about configuring global headers, see our Global Headers deep dive.
Enum descriptions and names
OpenAPI doesn't natively support adding descriptions to enum values. To do this in Fern you can use the
x-fern-enum
extension.
In the example below, we've added some descriptions to enum values. These descriptions will
propagate into the generated SDK and docs website.
x-fern-enum
also supports aname
field that allows you to customize the name of the enum in code.This is particularly useful when you have enums that rely on symbolic characters that would otherwise cause
generated code not to compile.
For example, the following OpenAPI
would generate
Schema names
OpenAPI allows you to define inlined schemas that do not have names.
Fern automatically generates names for all the inlined schemas. For example, in this example,
Fern would generate the name
CastItem
for the inlined array item schema.2.
/learn/sdks/deep-dives/configure-global-headers
(Configure Global Headers)Suggested Content (needs manual MDX fixes):
Specifying global headers
Fern automatically identifies headers that are used in every request, or the
majority of requests, and marks them as global. You can configure global headers in three ways:
To specify headers that are meant to be included on every request:
```yaml {3} name: api headers: X-App-Id: string ```Global path parameters
You can also specify path parameters that are meant to be included on every request:
```yaml name: api base-path: /{userId}/{orgId} path-parameters: userId: string orgId: string ```Overriding the base path
If you have certain endpoints that do not live at the configured
base-path
, you canoverride the
base-path
at the endpoint level.Use the
x-fern-global-headers
extension to label additional headers as globalor to alias the names of global headers:
This configuration yields the following client:
You can specify global headers in your
generators.yml
file using theheaders
configuration:This approach is particularly useful when you want to:
Header Configuration Priority
When configuring global headers across multiple locations, the priority order is:
generators.yml
configurations (highest priority)If the same header is defined in multiple places, the configuration from the higher priority source will take precedence.
Best Practices
When configuring global headers:
... [Content truncated due to length]