Skip to content

Context Aware fromHono #275

@jtbeckman

Description

@jtbeckman

With @hono/zod-openapi I am able to use Hono's context which lets me hook into bindings, request info, etc for environment specific properties.

  app.doc("/doc", (c) => {
    const appStage = getAppStage(c.env)

    return {
      openapi: "3.0.0",
      info: {
      },
      servers: [
        {
          url: appStageMetadata.serverUrl,
        },
      ],
    }
  })

Though with Chanfana I don't have that capability

  const openapi = fromHono(app, {
    // no context object
    docs_url: "/docs",
    openapi_url: "/openapi.json",
    schema: {
      info: {
      },
    },
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions