Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

@mattpodwysocki mattpodwysocki commented Dec 11, 2025

The Mapbox API sometimes returns primary_photo as a string and sometimes
as an array of strings. Update the schema to accept both types using
z.union() to prevent validation errors.

Fixes validation error: Expected array, received string for
features[].properties.metadata.primary_photo

The Mapbox API sometimes returns primary_photo as a string and sometimes
as an array of strings. Update the schema to accept both types using
z.union() to prevent validation errors.

Fixes validation error: Expected array, received string for
features[].properties.metadata.primary_photo

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner December 11, 2025 05:19
@mattpodwysocki mattpodwysocki merged commit 6600df1 into main Dec 11, 2025
5 checks passed
mattpodwysocki added a commit that referenced this pull request Jan 5, 2026
The Mapbox Search Box API can return metadata (including primary_photo
and Japanese reading information) for various feature types in forward
geocoding results. Currently, SearchAndGeocodeTool.output.schema.ts
doesn't include a metadata field, which could lead to validation errors
when the API returns this data.

This fix adds the metadata field with the same structure used in
CategorySearchTool (fixed in PR #77):
- primary_photo: Accepts both string and array of strings
- reading: Optional Japanese reading information (ja_kana, ja_latin)

This prevents validation failures when the API returns metadata fields.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
mattpodwysocki added a commit that referenced this pull request Jan 5, 2026
The Mapbox Search Box API can return metadata (including primary_photo
and Japanese reading information) for various feature types in forward
geocoding results. Currently, SearchAndGeocodeTool.output.schema.ts
doesn't include a metadata field, which could lead to validation errors
when the API returns this data.

This fix adds the metadata field with the same structure used in
CategorySearchTool (fixed in PR #77):
- primary_photo: Accepts both string and array of strings
- reading: Optional Japanese reading information (ja_kana, ja_latin)

This prevents validation failures when the API returns metadata fields.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.5 <[email protected]>
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