diff --git a/fern/products/sdks/guides/configure-global-headers.mdx b/fern/products/sdks/guides/configure-global-headers.mdx index 3d8093d3e..6beba197c 100644 --- a/fern/products/sdks/guides/configure-global-headers.mdx +++ b/fern/products/sdks/guides/configure-global-headers.mdx @@ -28,53 +28,6 @@ majority of requests, and marks them as global. You can manually configure addit global headers in either `api.yml` (Fern Definition) or `openapi.yml`. - - -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 can -override the `base-path` at the endpoint level. - -```yml imdb.yml {5} -service: - endpoints: - getMovie: - method: POST - base-path: "override/{arg}" - path: "movies/{movieId}" - path-parameters: - arg: string -``` - - - You cannot yet specify query parameters that are meant to be included on every request. -If you'd like to see this feature, please upvote [this issue](https://github.com/fern-api/fern/issues/2930). - - - For OpenAPI specifications, you can configure global headers in two ways: @@ -123,5 +76,52 @@ class Client: ``` + + + +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 can +override the `base-path` at the endpoint level. + +```yml imdb.yml {5} +service: + endpoints: + getMovie: + method: POST + base-path: "override/{arg}" + path: "movies/{movieId}" + path-parameters: + arg: string +``` + + + You cannot yet specify query parameters that are meant to be included on every request. +If you'd like to see this feature, please upvote [this issue](https://github.com/fern-api/fern/issues/2930). + + \ No newline at end of file diff --git a/fern/products/sdks/guides/customize-method-names.mdx b/fern/products/sdks/guides/customize-method-names.mdx index ea7c8a85a..4c0035739 100644 --- a/fern/products/sdks/guides/customize-method-names.mdx +++ b/fern/products/sdks/guides/customize-method-names.mdx @@ -82,22 +82,6 @@ For OpenAPI, use the `x-fern-sdk-group-name` and `x-fern-sdk-method-name` extens explicitly define your method name and grouping. - - -In the example below, Fern will generate a method called `client.users.create()`: - -```yaml title="users.yml" {4, 6} -services: - http: - UsersService: - base-path: /users # This defines the group/namespace for the methods - endpoints: - create: # This defines the specific method name within the group - method: POST - path: "" -``` - - In the example below, Fern will generate a @@ -150,6 +134,22 @@ paths: - notifications x-fern-sdk-method-name: send ``` + + + +In the example below, Fern will generate a method called `client.users.create()`: + +```yaml title="users.yml" {4, 6} +services: + http: + UsersService: + base-path: /users # This defines the group/namespace for the methods + endpoints: + create: # This defines the specific method name within the group + method: POST + path: "" +``` + diff --git a/fern/products/sdks/guides/filter-your-endpoints-audiences.mdx b/fern/products/sdks/guides/filter-your-endpoints-audiences.mdx index fa04ba036..f4289b837 100644 --- a/fern/products/sdks/guides/filter-your-endpoints-audiences.mdx +++ b/fern/products/sdks/guides/filter-your-endpoints-audiences.mdx @@ -22,106 +22,6 @@ be included in your SDK regardless of their audience tags. - - -Configuring audiences in a Fern Definition involves: - -1. Explicitly defining audiences in `api.yml`. -1. Configuring audiences for specific endpoints, types, and properties. -1. Apply audience filters to your SDK so only certain endpoints are passed to the generators. - - -### Defining audiences - -Audiences are explicitly declared in Fern Definition. -To use audiences in your Fern Definition, add them to `api.yml`. - -In the example below, we have created audiences for `internal`, `beta`, and `customer` groups: - -```yaml title='api.yml' {2-5} -name: api -audiences: - - internal - - beta - - customers -``` -### Apply audiences to your endpoints, types, and properties - -Once you've defined audiences, mark endpoints, types, or properties for a -particular consumer by adding an `audience` with the relevant groups. - - - - -In this example, the `sendEmail` endpoint is only available to internal consumers: - -```yaml title='user.yml' {6-7} -service: - base-path: /users - auth: true - endpoints: - sendEmail: - audiences: - - internal - path: /send-email - ... -``` - - - -Types can also be marked for different audiences. - -In this example, the `Email` type is available to internal and beta consumers: - -```yaml title='user.yml' {5-7} -Email: - properties: - subject: string - body: optional - audiences: - - internal - - beta -``` - - -In this example, the `to` property is available to beta consumers only: - -```yaml title='user.yml' {8-9} -Email: - properties: - subject: string - body: optional - to: - type: string - docs: The recipient of the email - audiences: - - beta -``` - - - -### Set up SDK filters in `generators.yml` - -In `generators.yml`, you can apply audience filters so that only certain -endpoints are passed to the generators. - -The following example configures the SDKs to filter for `customers`: - -```yaml title='generators.yml' {3-4} -groups: - external: - audiences: - - customers - generators: - ... -``` -### Generate your SDK - - ```bash - fern generate --group sdk - ``` - - Configuring audiences in an OpenAPI spec involves: @@ -236,4 +136,104 @@ groups: + + +Configuring audiences in a Fern Definition involves: + +1. Explicitly defining audiences in `api.yml`. +1. Configuring audiences for specific endpoints, types, and properties. +1. Apply audience filters to your SDK so only certain endpoints are passed to the generators. + + +### Defining audiences + +Audiences are explicitly declared in Fern Definition. +To use audiences in your Fern Definition, add them to `api.yml`. + +In the example below, we have created audiences for `internal`, `beta`, and `customer` groups: + +```yaml title='api.yml' {2-5} +name: api +audiences: + - internal + - beta + - customers +``` +### Apply audiences to your endpoints, types, and properties + +Once you've defined audiences, mark endpoints, types, or properties for a +particular consumer by adding an `audience` with the relevant groups. + + + + +In this example, the `sendEmail` endpoint is only available to internal consumers: + +```yaml title='user.yml' {6-7} +service: + base-path: /users + auth: true + endpoints: + sendEmail: + audiences: + - internal + path: /send-email + ... +``` + + + +Types can also be marked for different audiences. + +In this example, the `Email` type is available to internal and beta consumers: + +```yaml title='user.yml' {5-7} +Email: + properties: + subject: string + body: optional + audiences: + - internal + - beta +``` + + +In this example, the `to` property is available to beta consumers only: + +```yaml title='user.yml' {8-9} +Email: + properties: + subject: string + body: optional + to: + type: string + docs: The recipient of the email + audiences: + - beta +``` + + + +### Set up SDK filters in `generators.yml` + +In `generators.yml`, you can apply audience filters so that only certain +endpoints are passed to the generators. + +The following example configures the SDKs to filter for `customers`: + +```yaml title='generators.yml' {3-4} +groups: + external: + audiences: + - customers + generators: + ... +``` +### Generate your SDK + + ```bash + fern generate --group sdk + ``` + + \ No newline at end of file