cloudflare / chanfana

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

itty-router v4.x API changes coming! #31

Closed kwhitley closed 1 year ago

kwhitley commented 1 year ago

Just a heads up...

This shouldn't break anything on your end, but there are a bunch of quality of life enhancements coming to itty-router (core) very soon that you may want to include in your documentation. The more boilerplate we can remove, the easier all these libs are for folks to adopt! :)

https://github.com/kwhitley/itty-router/pull/148

G4brym commented 1 year ago

Hey @kwhitley thanks for posting this here I wasn't aware of such update coming to itty-router (core), we will do tests to ensure everything will work on this newer version and update our documentation as soon as possible

Thanks 😃

G4brym commented 1 year ago

Also, are you thinking in adding support for class-based endpoints in itty-router (core)? like what we got in here

import { OpenAPIRoute, Query, Int, Str } from '@cloudflare/itty-router-openapi'

export class ToDoList extends OpenAPIRoute {
  static schema = {...}

  async handle(request: Request, data: Record<string, any>) {
    const { page } = data

    return {
      currentPage: page,
      nextPage: page + 1,
      results: ['lorem', 'ipsum'],
    }
  }
}
kwhitley commented 1 year ago

Nah, that's out of scope for itty (at least for right now), so definitely on you guys :)

I'd be happy to explore it down the road though!

I'm pretty confident I just nailed the re-typing of itty, so all the latest can be found here, and hopefully we'll be looking at a final release (and off the next tag) in a day or two. Just finalizing the docs, and trying to get eyes/testers on it!

Main v4.x docs https://itty.dev/itty-router

Types https://itty.dev/itty-router/typescript

kwhitley commented 1 year ago

Btw, I'd love a simple example demo/description for this project (using the v4 itty-router@next) syntax - I'll add it to the docs with a link back to your full documentation :)

G4brym commented 1 year ago

Hey @kwhitley the upgrade to itty-router 4.x will take a while from our library, we are planning to bundle it with a lot of changes

kwhitley commented 1 year ago

I submitted a PR just now (#60) with the minimal impact inclusion if you're interested :)

G4brym commented 1 year ago

Closing this issue, has we have now fully migrated to itty-router 4.x Thanks @kwhitley 😄