OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!
MIT License
Bot releases are visible (Hide)
Full Changelog: https://github.com/cloudflare/chanfana/compare/v2.0.2...v2.0.3
Published by G4brym 4 months ago
OpenAPIRouter()
methodaiPlugin
optionskipValidation
option (see new validation method bellow)itty-router
is no longer a dependency and users must manually add it to their projectschema
is no longer a static variableschema.parameters
was renamed to schema.request
to follow zod-to-openapi structurePath
parameters are now called params
to match the validated Data object nameschema.requestBody
was renamed to schema.request.body
to follow zod-to-openapi structurehandle
function is called, developers must manually call the getValidatedData
to execute the data validation step
try {} catch (e) {}
to handle input errors, otherwise this library will return the errors in a Json response with http 400await this.getValidatedData<typeof this.schema>()
method to retrieve all validated data, when sending <typeof this.schema>
in the generic the returned value will have full typescript inference based on the schemafromIttyRouter()
instantiate methodfromHono()
instantiate methodMigration Guide: https://chanfana.pages.dev/user-guide/migrating-from-itty-router-openapi/
Full Changelog: https://github.com/cloudflare/chanfana/compare/v1.1.1...v2.0.2
Published by G4brym 6 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.1.0...v1.1.1
Published by G4brym 7 months ago
Now you can get full type hint and type check on the data
argument of every endpoint, learn more here!
export class TaskFetch extends OpenAPIRoute {
static schema = {
parameters: {
taskSlug: Path(Str, {
description: 'Task slug',
}),
},
}
async handle(request: Request, env: any, context: any, data: DataOf<typeof TaskFetch.schema>) {
// full type hint for query, path, header, and request body parameters!
data.params.taskSlug
// ...
}
}
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.14...v1.1.0
Published by G4brym 7 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.13...v1.0.14
Published by G4brym 7 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/1.0.13...v1.0.13
Published by G4brym 8 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.12...1.0.13
Published by G4brym 8 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.11...v1.0.12
Published by G4brym 8 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.10...v1.0.11
Published by G4brym 9 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.9...v1.0.10
Published by G4brym 9 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.8...v1.0.9
Published by G4brym 9 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.7...v1.0.8
Published by G4brym 9 months ago
o3.replace is Not a Function
error by Locking itty-router version to 4.0.26
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.6...v1.0.7
Published by G4brym 10 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.5...v1.0.6
Published by G4brym 11 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.4...v1.0.5
Published by G4brym 11 months ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.3...v1.0.4
Published by G4brym about 1 year ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.2...v1.0.3
Published by G4brym about 1 year ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.1...v1.0.2
Published by G4brym about 1 year ago
Full Changelog: https://github.com/cloudflare/itty-router-openapi/compare/v1.0.0...v1.0.1
Published by G4brym about 1 year ago
Migration guide to 1.0.0 available here!