cloudflare / chanfana

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

Allow binary content type #100

Closed henrytoone closed 1 year ago

henrytoone commented 1 year ago

Fixes bug raised in #99

henrytoone commented 1 year ago

Just noticed that this allows the option to be set but the format property still does not get added to the openapi spec schema - see below

openapi.json

What it looks like

"content": {
    "image/png": {
        "schema": {
            "type":"string"
        }
    }
}

What it should look like

"content": {
    "image/png": {
        "schema": {
            "type":"string",
            "format": "binary"
        }
    }
}



Not had chance to properly look into how to do this but can imagine it should be fairly trivial for someone who knows the codebase well - so open to any suggestions on how; or commits directly to my branch :)

github-actions[bot] commented 1 year ago

🧪 A prerelease is available for testing 🧪

You can install this latest build in your project with:

npm install --save https://prerelease-registry.devprod.cloudflare.dev/itty-router-openapi/runs/6187683101/npm-package-itty-router-openapi-100

Or you can immediately run this with npx:

npx https://prerelease-registry.devprod.cloudflare.dev/itty-router-openapi/runs/6187683101/npm-package-itty-router-openapi-100
G4brym commented 1 year ago

Thanks @henrytoone for doing this pr, you were only missing adding the format field to the field schema, i pushed that change into your pr before merging