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

fix(swagger/oidc): fix swagger and oidc docs #1159

Merged
merged 11 commits into from
Sep 6, 2024
2 changes: 1 addition & 1 deletion .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: create spec
run: |
sudo make spec-install
make spec-install
make spec

- name: upload spec
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ jobs:

- name: validate spec
run: |
sudo make spec-install
make spec-install
make spec
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,10 @@ spec-install:
$(if $(shell command -v apt-get 2> /dev/null),,$(error 'apt-get' not found - install jq, sponge, and go-swagger manually))
@echo
@echo "### Installing utilities (jq and sponge)"
@apt-get update
@apt-get install -y jq moreutils
@echo "### Downloading and installing go-swagger"
@curl -o /usr/local/bin/swagger -L "https://github.com/go-swagger/go-swagger/releases/download/v0.30.2/swagger_linux_amd64"
@chmod +x /usr/local/bin/swagger
@sudo apt-get update
@sudo apt-get install -y jq moreutils
@echo "### Installing go-swagger"
@go install github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0

# The `spec-gen` target is intended to create an api-spec
# using go-swagger (https://goswagger.io)
Expand Down
2 changes: 0 additions & 2 deletions api/jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
// produces:
// - application/json
// parameters:
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully retrieved the Vela JWKS
Expand Down
2 changes: 0 additions & 2 deletions api/oi_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
// produces:
// - application/json
// parameters:
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully retrieved the Vela OpenID Configuration
Expand Down
13 changes: 10 additions & 3 deletions api/types/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package types

import (
"github.com/golang-jwt/jwt/v5"
"github.com/lestrrat-go/jwx/v2/jwk"
)

// OpenIDConfig is a struct that represents the OpenID Connect configuration.
Expand Down Expand Up @@ -40,9 +39,17 @@ type OpenIDClaims struct {
jwt.RegisteredClaims
}

// JWKSet is a wrapper of lestrrat-go/jwx/jwk.Set for API Swagger gen.
// JWKSet exists solely to provide proper swagger documentation.
// It is not otherwise used in code.
//
// swagger:model JWKSet
type JWKSet struct {
jwk.Set
Keys []JWK `json:"keys"`
}

type JWK struct {
Kty string `json:"kty"`
Kid string `json:"kid"`
E string `json:"e"`
N string `json:"n"`
}
Loading