-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build openapi spec from golang annotations
- Loading branch information
1 parent
d27b17f
commit 6b2a80d
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
entrypoint: | ||
required: true | ||
type: string | ||
default: "main.go" | ||
|
||
jobs: | ||
build_with_swagger: | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
container: | ||
image: cubicrootxyz/golang-ci:v1.23.0 | ||
options: --user root | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "14" | ||
- name: Get dependencies | ||
run: go get ./... | ||
- name: Make docs folder | ||
run: mkdir -p docs | ||
- name: Build the api documentation | ||
run: swag init --parseDependency=true -d . -g ${{ inputs.entrypoint }} | ||
- name: Archive OpenAPI spec | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: openapi-spec | ||
path: | | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
on: push | ||
|
||
jobs: | ||
openapi2_golang_build_test: | ||
uses: ./.github/workflows/openapi2_golang_build.yaml | ||
with: | ||
entrypoint: tests/openapi2/main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module openapi2 | ||
|
||
go 1.23.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
// @title Matrix Reminder and Calendar Bot (RemindMe) | ||
// @version 2.0.0 | ||
// @description API documentation for the matrix reminder and calendar bot. | ||
|
||
// @contact.name Support | ||
|
||
// @host your-bot-domain.tld | ||
// @BasePath / | ||
// @query.collection.format multi | ||
|
||
// @securityDefinitions.apikey APIKeyAuthentication | ||
// @in header | ||
// @name Authorization | ||
func main() { | ||
os.Exit(0) | ||
} |