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

Add server URL, which mostly fixes usage on non-default bases. #19

Closed Manouchehri closed 1 year ago

Manouchehri commented 1 year ago

Partly resolves #20.

G4brym commented 1 year ago

Hey @Manouchehri I don't think setting the servers object is the right way to solve this issue, the problem should already be fixed in the latest release

If you want to define a servers object for your project you can already do so in the router like this

const router = OpenAPIRouter({
    schema: {
        servers: [
            {
                url: 'plans/'
            }
        ]
    }
})
Manouchehri commented 1 year ago

If I define:

const router = OpenAPIRouter({
    schema: {
        servers: [
            {
                url: 'plans/'
            }
        ]
    }
})

Then the docs aren't actually served from /plans/docs, but rather /docs. It doesn't behave as expected IMO.