cloudflare / chanfana

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!
https://chanfana.pages.dev
MIT License
293 stars 39 forks source link

Support for `application/x-www-form-urlencoded` #173

Open thelovekesh opened 1 week ago

thelovekesh commented 1 week ago

It seems like this implementation only currently supports content-type applciation/json. Is it possible to use application/x-www-form-urlencoded by any chance?

tam-nique commented 1 week ago

if you are using along with hono, you can parseBody first then ask to validate schema. Sample request schema definition:

Screenshot 2024-09-09 at 12 16 16

Handle:

Screenshot 2024-09-09 at 12 16 02

Here you have body.file is the FIle instance Hope this help

thelovekesh commented 1 week ago

Thanks @tam-nique, that's helpful. But I was looking for something out of the box as the application/x-www-form-urlencoded and multipart/form-data are largely used content encodings.

I could put up a PR but need some guidance/confirmation from the maintainers.