Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 4, 2025

Document x-fern-sdk-variables OpenAPI extension

Summary

This PR adds comprehensive documentation for the x-fern-sdk-variables OpenAPI extension, which allows defining common path parameters at the document level. These variables (like tenant IDs or environment identifiers) are set once during SDK client initialization rather than passed to each method call.

Changes:

  • Created new documentation page at /openapi/extensions/sdk-variables with configuration examples and SDK usage patterns for TypeScript, Python, and Java
  • Added navigation entry in api-def.yml for sidebar visibility
  • Updated extensions overview page to include the new extension in the available extensions table
  • Documented minimum versions: TypeScript 2.6.3+, Python 4.24.0+, Java 3.6.3+
  • Used plant-themed examples (gardens, plants, zones) per content guidelines
  • Added syntax highlighting to emphasize x-fern-sdk-variables and x-fern-sdk-variable extensions

Review & Testing Checklist for Human

  • ⚠️ CRITICAL: Verify documented behavior through actual SDK generation - The documentation was written based on code research in fern-api/fern, NOT by actually generating and testing SDKs. Create a test OpenAPI spec with the documented configuration and generate SDKs for TypeScript, Python, and Java to confirm: (1) variables appear as required constructor parameters, (2) variables are NOT method parameters, (3) variables are correctly injected into path parameters in HTTP requests, (4) the code examples match actual generated code structure.

  • Verify minimum version numbers - The versions (TypeScript 2.6.3, Python 4.24.0, Java 3.6.3) were determined through git history research. Python 4.24.0 has an explicit changelog entry, but TypeScript/Java versions were inferred from bug fix commits. Consider testing with earlier versions to confirm they lack support, or check release notes/changelogs to confirm these are the first versions with the feature.

  • Test the string-only limitation - The documentation states SDK variables only support string types based on code in getVariableDefinitions.ts that checks schema.type === "string". Verify this by attempting to define variables with other types (integer, boolean, object) and confirming they're rejected with the documented error message.

  • Test navigation and links after deployment - Verify the sidebar link works correctly and the link from /learn/api-definitions/openapi/extensions/overview navigates to the new SDK variables page at the correct URL.

Recommended test plan

Create a minimal OpenAPI spec to validate the documented behavior:

openapi: 3.0.0
info:
  title: Test API
  version: 1.0.0

x-fern-sdk-variables:
  gardenId:
    type: string

paths:
  /gardens/{gardenId}/plants:
    get:
      parameters:
        - name: gardenId
          in: path
          required: true
          x-fern-sdk-variable: gardenId
          schema:
            type: string
      responses:
        '200':
          description: Success

Generate SDKs for all three languages and verify the behavior matches the documentation examples.

Notes

  • Documentation written based on research of fern-api/fern implementation (OpenAPI parser at packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/extensions/, IR definitions, and TypeScript/Python/Java generator code)
  • The string-only limitation is enforced by the OpenAPI importer; the IR itself supports any TypeReference but the OpenAPI parser currently only accepts string types
  • Code highlighting emphasizes the extension names to help users identify the key configuration elements
  • Link to Devin session: https://app.devin.ai/sessions/c431328b5b1848658e791fd897a83ced
  • Requested by: thomas@buildwithfern.com (@tjb9dc)

Co-Authored-By: thomas@buildwithfern.com <tjb9dcshop@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Co-Authored-By: thomas@buildwithfern.com <tjb9dcshop@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

…gestion

Co-Authored-By: thomas@buildwithfern.com <tjb9dcshop@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Co-Authored-By: thomas@buildwithfern.com <tjb9dcshop@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Co-Authored-By: thomas@buildwithfern.com <tjb9dcshop@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

@tjb9dc tjb9dc requested a review from devalog November 4, 2025 22:36
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@tjb9dc tjb9dc merged commit 73747dd into main Nov 5, 2025
2 checks passed
@tjb9dc tjb9dc deleted the devin/1762263551-document-sdk-variables-extension branch November 5, 2025 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants