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

Cannot disable docs endpoints #29

Closed marcelogp closed 1 year ago

marcelogp commented 1 year ago

Hello. I would like to control whether /docs and /redocs and /openapi.json endpoints are enabled or not. I see in the code the check below but it doesn't seem possible to pass openapiConfig as undefined.

https://github.com/cloudflare/itty-router-openapi/blob/main/src/openapi.ts#L103

G4brym commented 1 year ago

Hey @marcelogp i've just added support for disabling or changing the path for all theses routes in the latest release (v0.1.0) You can see the new options in here In order to disable them you just need to pass these parameters as null

marceloverdijk commented 5 months ago

@G4brym the link mentioned does not work unfortunately. How should I disable this?

marceloverdijk commented 5 months ago

https://github.com/cloudflare/itty-router-openapi/blob/main/src/types.ts#L19-L21

I assume just ;-)

const router = OpenAPIRouter({
  docs_url: null,
  redoc_url: null,
  openapi_url: null,
})