Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "securitySchemes" to generateOpenApiDocumentation options #302

Merged
merged 3 commits into from
May 24, 2023

Conversation

mrgoonie
Copy link
Contributor

So we can use other security schemes (such as ApiKey, OpenID,...) other than http (for Basic, Bearer)

Examples

const openApiDocument = generateOpenApiDocument(appRouter, {
  title: 'tRPC OpenAPI',
  version: '1.0.0',
  description: 'API documentation',
  baseUrl: 'http://localhost:3000/api',
  docsUrl: 'http://localhost:3000/docs',
  tags: [],
  securitySchemes = {
    // default
    Authorization: {
      type: 'http',
      scheme: 'bearer',
    },
    // additional schemes
    ApiKey: {
      type: 'apiKey'
      in: 'header'
      name: 'X-API-Key'
    }
  },
});

Ref

https://swagger.io/docs/specification/authentication/

Related issues

@jlalmes jlalmes merged commit ca16875 into jlalmes:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants