swagger-typescript-api
swagger-typescript-api copied to clipboard
Improve implicit FormFata detection. Add tests.
Avoid matching "File" type usage too broadly. Fixes https://github.com/acacode/swagger-typescript-api/issues/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/binarytypes (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
Filedo.- Component names containing "File" do not trigger FormData.
Written by Cursor Bugbot for commit 4a3990578536e439a2e8fbd89273fe00d0f78bdc. This will update automatically on new commits. Configure here.