Other Extensions

Additional Fern extensions for AsyncAPI specifications

Fern supports various extensions to enhance your AsyncAPI specifications and improve the generated SDKs and documentation.

x-fern-ignore

Use x-fern-ignore to exclude specific operations, channels, or schemas from SDK generation:

asyncapi.yml
1operations:
2 debugOperation:
3 action: send
4 channel:
5 $ref: '#/channels/debug'
6 x-fern-ignore: true
7 summary: Debug operation (internal only)
8
9channels:
10 internal/debug:
11 address: internal/debug
12 x-fern-ignore: true
13 messages:
14 DebugMessage:
15 $ref: '#/components/messages/DebugMessage'

x-fern-examples

Provide additional examples for better SDK documentation:

asyncapi.yml
1components:
2 messages:
3 UserEvent:
4 contentType: application/json
5 payload:
6 $ref: '#/components/schemas/User'
7 x-fern-examples:
8 - name: NewUserSignup
9 summary: Example of a new user signup event
10 payload:
11 id: "user_123"
12 email: "john@example.com"
13 name: "John Doe"
14 status: "active"
15 - name: UserDeactivation
16 summary: Example of user deactivation event
17 payload:
18 id: "user_456"
19 email: "jane@example.com"
20 name: "Jane Smith"
21 status: "inactive"

x-fern-pagination

Configure pagination for operations that return multiple results:

asyncapi.yml
1operations:
2 listUserEvents:
3 action: receive
4 channel:
5 $ref: '#/channels/user~1events'
6 x-fern-pagination:
7 cursor: next_cursor
8 results: events
9 next_cursor: pagination.next_cursor
10 has_next_page: pagination.has_next_page

x-fern-retry

Configure retry behavior for operations:

asyncapi.yml
1operations:
2 sendCriticalAlert:
3 action: send
4 channel:
5 $ref: '#/channels/alerts'
6 x-fern-retry:
7 max_attempts: 3
8 exponential_backoff: true
9 initial_delay: 1000
10 max_delay: 30000

x-fern-streaming

Mark operations as streaming for appropriate SDK generation:

asyncapi.yml
1operations:
2 streamEvents:
3 action: receive
4 channel:
5 $ref: '#/channels/event~1stream'
6 x-fern-streaming:
7 type: server_sent_events
8 termination: client_closes

x-fern-error-handling

Configure error handling for operations:

asyncapi.yml
1operations:
2 sendMessage:
3 action: send
4 channel:
5 $ref: '#/channels/messages'
6 x-fern-error-handling:
7 error_schema:
8 $ref: '#/components/schemas/MessageError'
9 error_status_codes:
10 - 400
11 - 429
12 - 500
13 retry_on_errors:
14 - 429
15 - 500

x-fern-server-name

Specify custom names for servers:

asyncapi.yml
1servers:
2 production:
3 host: api.yourcompany.com
4 x-fern-server-name: Production
5 protocol: wss
6 staging:
7 host: staging.api.yourcompany.com
8 x-fern-server-name: Staging
9 protocol: wss

x-fern-availability

Mark features as available in specific SDK versions:

asyncapi.yml
1operations:
2 newFeature:
3 action: send
4 channel:
5 $ref: '#/channels/new~1feature'
6 x-fern-availability:
7 status: beta
8 message: "This feature is in beta and may change"

These extensions help you create more robust and user-friendly SDKs while maintaining full control over the generated code structure and behavior.