🌿 Fern Scribe: Fern supports Webhooks as part of openapi 3.1, we ... #328
+59
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌿 Fern Scribe Documentation Update
Original Request: Fern supports Webhooks as part of openapi 3.1, we need to document that.
Files Updated:
fern/products/fern-def/pages/webhooks.mdx
fern/products/openapi-def/pages/webhooks.mdx
Priority: Medium
Related Discussion: https://buildwithfern.slack.com/archives/C07EQ2VEFU5/p1748360947074069?thread_ts=1748360905.972659&cid=C07EQ2VEFU5
Additional Context: we currently support the OpenAPI 3.1 webhooks! For example in the openapi you referenced. You can use it directly if you add an operationId to each webhook operation:
webhooks:
Each webhook needs a name
newPet:
# This is a Path Item Object, the only difference is that the request is initiated by the API provider
post:
operationId: newPetWebhook
requestBody:
description: Information about a new pet in the system
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
'200':
description: Return a 200 status to indicate that the data was received successfully
The following files could not be updated due to MDX validation failures after 3 attempts:
1.
/learn/docs/api-references/generate-webhook-reference
(Generate Webhook Reference)Suggested Content (needs manual MDX fixes):
For OpenAPI 3.0, you can use the
x-fern-webhook: true
extension to mark endpoints as webhooks.Setting Up Your Documentation
Example documentation configuration:
For a real-world example of webhook documentation generated from an API definition, check out Webflow's Webhooks.
Directory Structure
Your webhooks should be defined in a dedicated folder within your Fern project:
```bash fern/ └── apis/ ├── webhooks-v1/ # Webhook definition │ ├── openapi/ │ │ └── openapi.yml │ └── generators.yml └── api-v1/ # Regular API endpoints ```If you're using OpenAPI, your
generators.yml
file should point to your OpenAPI specification:You can read more about how to define webhooks in your OpenAPI specification here.
You can read more about how to define webhooks in your Fern Definition here.
Include more than one Webhook Reference
To include multiple webhook definitions in your documentation, use the
webhook-name
property:When using multiple webhook definitions, organize them in separate directories within your Fern project: