Commit 3ad9f96
fix(path-alias-resolution): resolve critical schema validation errors in resolve_import
**Root Cause:**
- Field name mismatch in cross_reference_service.py:183
- Service returned "type" field but ImportAlternative model expected "link_type"
- Caused "10 validation errors for ResolveImportResponse" preventing path alias resolution
**Technical Solution:**
1. **Schema Field Alignment**: Changed "type" → "link_type" in alternatives generation
2. **Backward Compatibility**: Added AliasChoices for robust field aliasing
3. **MCP Parameter Validation**: Added resolve_import to FastMCP schema override
**Validation Results:**
✅ resolve_import('serde', 'Deserialize') → 'serde::de::Deserialize'
✅ include_alternatives boolean parameter validates correctly
✅ No more Pydantic validation errors in response serialization
✅ PATH_ALIASES system confirmed working with 105+ alias mappings
**Files Changed:**
- src/docsrs_mcp/services/cross_reference_service.py: Fix field name in alternatives
- src/docsrs_mcp/models/cross_references.py: Add AliasChoices for link_type field
- src/docsrs_mcp/mcp_server.py: Add resolve_import to tools_to_fix dictionary
- Architecture.md: Document bug fix in CrossReferenceService section
- UsefulInformation.json: Add comprehensive solution documentation
**Impact:**
Restores complete Path Alias Resolution functionality for common Rust aliases like
serde::Deserialize, tokio::spawn, etc. Eliminates schema validation failures that
prevented proper import resolution and suggestion generation.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent c25a440 commit 3ad9f96
File tree
5 files changed
+60
-3
lines changed- src/docsrs_mcp
- models
- services
5 files changed
+60
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2754 | 2754 | | |
2755 | 2755 | | |
2756 | 2756 | | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
2757 | 2790 | | |
2758 | 2791 | | |
2759 | 2792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4970 | 4970 | | |
4971 | 4971 | | |
4972 | 4972 | | |
| 4973 | + | |
| 4974 | + | |
| 4975 | + | |
| 4976 | + | |
| 4977 | + | |
| 4978 | + | |
| 4979 | + | |
| 4980 | + | |
| 4981 | + | |
| 4982 | + | |
| 4983 | + | |
| 4984 | + | |
| 4985 | + | |
| 4986 | + | |
| 4987 | + | |
| 4988 | + | |
| 4989 | + | |
| 4990 | + | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
4973 | 4994 | | |
4974 | 4995 | | |
4975 | 4996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
0 commit comments