Skip to content

Conversation

@aphofstede
Copy link

@aphofstede aphofstede commented Dec 2, 2025

Avoid matching "File" type usage too broadly.
Fixes #1538


Note

Use precise regex matching to detect actual File/binary request bodies as FormData and add tests covering custom formats and false positives.

  • Schema Routes (src/schema-routes/schema-routes.ts):
    • Refine implicit FormData detection: replace simple substring check with escaped regex that matches whole File/binary types (including arrays/unions) while avoiding false positives (e.g., FileType).
  • Tests (tests/spec/implicitFormData/):
    • Add OpenAPI schema (schema.json), test (basic.test.ts), and snapshot verifying:
      • File/binary properties trigger FormData.
      • Custom formats mapping to non-File types (e.g., FileType) do not.
      • Custom formats mapping to File do.
      • Component names containing "File" do not trigger FormData.

Written by Cursor Bugbot for commit 4a39905. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

⚠️ No Changeset found

Latest commit: 4a39905

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@aphofstede aphofstede force-pushed the fix/1538-content-type-detection branch from e12e441 to 4a39905 Compare December 2, 2025 18:23
@aphofstede aphofstede changed the title Improve implicit form data detection. Add tests. Improve implicit FormFata detection. Add tests. Dec 4, 2025
@smorimoto
Copy link
Collaborator

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


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.

Custom type named FileXyz triggers content type workaround

2 participants