F/auto update openapi paths #929
Merged
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.
Greptile Summary
This PR enhances the OpenAPI path auto-update feature to intelligently repoint references when entries move between spec files. The implementation adds a new
specHasMatch()helper function and extends theresolveSpec()function to detect when an explicitly referenced spec no longer contains a required operation/webhook/schema, then searches for alternatives. When exactly one alternative is found, it automatically repoints the reference with a warning; when multiple alternatives or none exist, it gracefully skips localization. The feature is well-tested with a new comprehensive test case covering the spec-switching scenario. This improves developer experience by automatically correcting stale OpenAPI references in frontmatter when documentation schemas evolve.Confidence Score: 5/5
specHasMatch()helper; (2) Comprehensive test coverage with a new test case validating the spec-repointing behavior; (3) Robust error handling with appropriate warnings for edge cases (missing entries, multiple matches, no matches); (4) No breaking changes to existing logic - new behavior only triggers when explicit specs don't contain referenced entries; (5) Code quality is high with proper type safety and documentation.Important Files Changed
specHasMatchchecks if a spec contains operations, webhooks, or schemas. EnhancedresolveSpecfunction now handles spec changes: single alternative repoints, multiple alternatives skip with warning, no alternatives skip with warning. Code quality is high with proper error handling and warnings.Sequence Diagram
sequenceDiagram participant MD as Markdown File participant PR as processOpenApi() participant RS as resolveSpec() participant SM as specHasMatch() participant FM as fileMapping MD->>PR: Start processing file PR->>RS: Resolve explicit spec path RS->>SM: Check if spec contains entry SM-->>RS: Entry not in spec RS->>RS: Find alternatives in other specs RS->>SM: Check each alternative SM-->>RS: Found in spec-b only RS->>FM: Resolve localized path for spec-b FM-->>RS: Return locale-specific path RS->>PR: Return alternative spec PR->>MD: Update frontmatter with new spec path Note over PR: Warnings logged for reference changes