Examples in Fern Definition
Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.
You can add examples for types and endpoints. Examples are shown as comments in your SDKs, in the request & response of your documentation, and in a Postman Collection.
Validation
The Fern CLI validates that your examples match the expected types. The following won’t compile:
Referencing examples
You can reference an example from another type, endpoint, or error.
Just like types, you can compose examples. To reference an example from another
type, use $.
Examples for types
Objects
Lists
Unions
Discriminated union
Undiscriminated union
Aliases
Examples for endpoints
You can add examples of successful and error responses for your endpoints. Examples can reference the examples of types to avoid duplication.
Examples with headers
When you have global headers defined in your api.yml, you must include them in your examples: