Skip to content

🧩 fix: additionalProperties Handling and Ref Resolution in Zod Schemas - #8381

Merged
danny-avila merged 4 commits into
devfrom
fix/json-schema-refs-empty-objects
Jul 10, 2025
Merged

danny-avila merged 4 commits into
devfrom
fix/json-schema-refs-empty-objects

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I addressed problems with the handling of additionalProperties and improved reference resolution within Zod schema generation, while also relocating Zod logic and type definitions from packages/data-provider to packages/api for better structure.

  • Fixed logic in Zod utilities to correctly process additionalProperties within JSON schemas.
  • Enhanced resolveJsonSchemaRefs for better reference ($ref) resolution during schema conversion.
  • Moved Zod-related files and types into packages/api to improve maintainability and module boundaries.
  • Updated all imports and typedefs to reflect the new location and prevented type conflicts.
  • Validated with comprehensive tests that additionalProperties and $ref behaviors now align with expected outcomes.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Testing

I ran existing and new tests addressing additionalProperties scenarios and $ref resolution in packages/api/src/mcp/zod.spec.ts. Please run pnpm test within packages/api to confirm correctness, with particular focus on tests related to complex property and $ref schemas.

Test Configuration:

  • Node.js v20.x
  • pnpm v8.x

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

@danny-avila danny-avila changed the title 🧩 fix: Correct additionalProperties Handling and Ref Resolution in Zod Schemas 🧩 fix: additionalProperties Handling and Ref Resolution in Zod Schemas Jul 10, 2025
@danny-avila
danny-avila merged commit 4bbdc4c into dev Jul 10, 2025
@danny-avila
danny-avila deleted the fix/json-schema-refs-empty-objects branch July 10, 2025 22:02
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Aug 4, 2025
…mas (LibreChat-AI#8381)

* fix: false flagging object as empty object when it has `additionalProperties` field

* 🔧 fix: Implement $ref resolution in JSON Schema handling

* 🔧 fix: Resolve JSON Schema references before conversion to Zod

* chore: move zod logic packages/api
xycjscs pushed a commit to xycjscs/LibreChat that referenced this pull request Aug 9, 2025
…mas (LibreChat-AI#8381)

* fix: false flagging object as empty object when it has `additionalProperties` field

* 🔧 fix: Implement $ref resolution in JSON Schema handling

* 🔧 fix: Resolve JSON Schema references before conversion to Zod

* chore: move zod logic packages/api
patricksn3ll pushed a commit to patricksn3ll/LibreChat that referenced this pull request Dec 11, 2025
…mas (LibreChat-AI#8381)

* fix: false flagging object as empty object when it has `additionalProperties` field

* 🔧 fix: Implement $ref resolution in JSON Schema handling

* 🔧 fix: Resolve JSON Schema references before conversion to Zod

* chore: move zod logic packages/api
jcbartle pushed a commit to jcbartle/LibreChat that referenced this pull request May 11, 2026
…mas (LibreChat-AI#8381)

* fix: false flagging object as empty object when it has `additionalProperties` field

* 🔧 fix: Implement $ref resolution in JSON Schema handling

* 🔧 fix: Resolve JSON Schema references before conversion to Zod

* chore: move zod logic packages/api
ThomasVuNguyen pushed a commit to ThomasVuNguyen/LibreChat that referenced this pull request Jul 15, 2026
…mas (LibreChat-AI#8381)

* fix: false flagging object as empty object when it has `additionalProperties` field

* 🔧 fix: Implement $ref resolution in JSON Schema handling

* 🔧 fix: Resolve JSON Schema references before conversion to Zod

* chore: move zod logic packages/api
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.

1 participant