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

feat: add buf plugin to generate openapiv2 spec #2843

Merged
merged 1 commit into from
Jan 27, 2024

Conversation

lincolnthalles
Copy link
Contributor

I was unable to use the plugin opt openapi_configuration to supply the additional API configuration file (it simply doesn't find the file), but it's a matter of API users replacing the first 4 lines of v2.swagger.yaml with something like this:

swagger: "2.0"
host: "demo.usememos.com"
schemes:
  - https
  - http
securityDefinitions:
  Bearer:
    type: apiKey
    in: header
    name: Authorization
    description: >-
      Enter the Memos token with the `Bearer` prefix, e.g. "Bearer abcde12345"
security:
  - Bearer: []
info:
  title: Memos API
  version: 2.0.0

This enables interacting with v2 API using Insomnia built-in Swagger-UI or even using the web-hosted Swagger Editor.
image

By the way, there's not much control of file name, the plugin will always append ".swagger.yaml".

It's just a matter of running buf generate after changes on v2 API and commiting v2.swagger.yaml to keep the spec updated.

Copy link
Member

@boojack boojack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boojack boojack merged commit 887903b into usememos:main Jan 27, 2024
4 checks passed
@lincolnthalles lincolnthalles deleted the feat/add-openapiv2-spec branch June 10, 2024 12:30
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.

2 participants