Skip to content

refactor: add object page links to schema descriptions#1257

Draft
razor-x wants to merge 2 commits into
mainfrom
claude/mintlify-openapi-ref-x4ahpa
Draft

refactor: add object page links to schema descriptions#1257
razor-x wants to merge 2 commits into
mainfrom
claude/mintlify-openapi-ref-x4ahpa

Conversation

@razor-x

@razor-x razor-x commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

This change automatically appends "See the <type> object." sentences to OpenAPI schema descriptions for resources that have dedicated object pages. This improves discoverability by linking endpoint responses to their full resource reference documentation.

Key Changes

  • New metadata system: Added ObjectPageMetadata type to track which routes render object pages, enabling the codegen pipeline to map blueprint resources to their documentation pages
  • Object page link mapping: Implemented buildObjectPageLinks() function that:
    • Maps each blueprint resource type to its object page URL
    • Respects resource routing (resources at their own route claim the type)
    • Handles explicit resource types defined in metadata
    • Filters out endpoint-listing and namespace pages
  • Schema description enhancement: Modified transformComponents() to append object page links to all schemas that back object pages, ensuring the link appears after any truncation
  • Action attempt linking: Updated createScopedActionAttempt() to include object page links for inline action_attempt schemas in endpoint responses
  • Openapi plugin integration: Updated the Metalsmith plugin to accept and pass through objectPages metadata to the transform function

Implementation Details

The solution uses a two-pass approach:

  1. Build a map of resource types to their object pages during spec transformation
  2. Append link sentences to schema descriptions, with special handling for inline action_attempt schemas

Links are appended after other description content and truncation to ensure they're never cut off in the rendered documentation. The implementation respects the existing resource routing logic where resources documented at their own route take precedence over filtered views.

https://claude.ai/code/session_01Y31Y4b3uGxyoeG7nVmum5S

claude and others added 2 commits July 9, 2026 22:03
Append a 'See [the `device` object](/api/devices/object).' sentence to
every component schema that backs a generated object page, so Mintlify's
inline-expanded endpoint responses point readers at the full resource
reference. Scoped per-endpoint action_attempt schemas get the same link.

Only resources actually rendered on an object page are linked: sampled
resources at the page's own route, plus explicit resource_type pages
(e.g. /action_attempts). Filtered views of a shared resource (/locks,
/thermostats) don't claim the type.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y31Y4b3uGxyoeG7nVmum5S
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.

2 participants