Skip to content

Commit

Permalink
Merge 72e3bd6 into dbfb801
Browse files Browse the repository at this point in the history
  • Loading branch information
adelowo committed May 3, 2019
2 parents dbfb801 + 72e3bd6 commit d89c98a
Show file tree
Hide file tree
Showing 9 changed files with 1,647 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ install:
- go install ./...
# As of 1.9, ./... no longer includes ./vendor/...
- go install ./vendor/{golang.org/x/tools/cmd/goimports,github.com/wadey/gocovmerge,github.com/mattn/goveralls}
- go get github.com/go-swagger/go-swagger/cmd/swagger

script:
- sudo pip3 install google
- sudo pip3 install protobuf
### Needed to convert the swagger 2.0 file to openapi 3.0
### The swagger docs are actually written as per the 2.0 spec as there is no
### support for openapi 3.0 in Go - at least for now.
### https://github.com/nodesource/distributions/blob/master/README.md#debinstall
- curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install nodejs
- sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root
- go build -tags 'coprocess python'
- go build -tags 'coprocess lua'
- go build -tags 'coprocess grpc'
- ./utils/ci-swagger.sh
- ./utils/ci-test.sh
- if [[ $LATEST_GO ]]; then goveralls -coverprofile=<(gocovmerge *.cov); fi
- ./utils/ci-benchmark.sh
37 changes: 36 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
// Tyk Gateway API
//
// The code below describes the Tyk Gateway API
// Version: 2.8.0
//
// Schemes: https, http
// Host: localhost
// BasePath: /tyk/
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Security:
// - api_key:
//
// SecurityDefinitions:
// api_key:
// type: apiKey
// name: X-Tyk-Authorization
// in: header
//
// swagger:meta
package main

import (
Expand Down Expand Up @@ -28,16 +53,22 @@ import (
)

// apiModifyKeySuccess represents when a Key modification was successful
//
// swagger:model apiModifyKeySuccess
type apiModifyKeySuccess struct {
// in:body
Key string `json:"key"`
Status string `json:"status"`
Action string `json:"action"`
KeyHash string `json:"key_hash,omitempty"`
}

// apiStatusMessage represents an API status message
//
// swagger:model apiStatusMessage
type apiStatusMessage struct {
Status string `json:"status"`
Status string `json:"status"`
// Response details
Message string `json:"message"`
}

Expand Down Expand Up @@ -448,6 +479,7 @@ func handleGetDetail(sessionKey, apiID string, byHash bool) (interface{}, int) {
}

// apiAllKeys represents a list of keys in the memory store
// swagger:model
type apiAllKeys struct {
APIKeys []string `json:"keys"`
}
Expand Down Expand Up @@ -1101,6 +1133,7 @@ func groupResetHandler(w http.ResponseWriter, r *http.Request) {
// was in the URL parameters, it will block until the reload is done.
// Otherwise, it won't block and fn will be called once the reload is
// finished.
//
func resetHandler(fn func()) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var wg sync.WaitGroup
Expand Down Expand Up @@ -1255,6 +1288,8 @@ func createKeyHandler(w http.ResponseWriter, r *http.Request) {
}

// NewClientRequest is an outward facing JSON object translated from osin OAuthClients
//
// swagger:model NewClientRequest
type NewClientRequest struct {
ClientID string `json:"client_id"`
ClientRedirectURI string `json:"redirect_uri"`
Expand Down
2 changes: 2 additions & 0 deletions apidef/api_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ type OpenIDOptions struct {
}

// APIDefinition represents the configuration for a single proxied API and it's versions.
//
// swagger:model
type APIDefinition struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Name string `bson:"name" json:"name"`
Expand Down
1 change: 1 addition & 0 deletions oauth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ const (
prefixClientTokens = "oauth-client-tokens."
)

// swagger:model
type OAuthClientToken struct {
Token string `json:"code"`
Expires int64 `json:"expires"`
Expand Down
25 changes: 25 additions & 0 deletions swagger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/user"
)

// parameterBodies
// swagger:response parameterBodies
type swaggerParameterBodies struct {
// in: body
APIStatusMessage apiStatusMessage
// in: body
APIModifyKeySuccess apiModifyKeySuccess
// in: body
NewClientRequest NewClientRequest
// in: body
APIDefinition apidef.APIDefinition
// in: body
SessionState user.SessionState
// in:body
APIAllKeys apiAllKeys
// in: body
OAuthClientToken OAuthClientToken
}
Loading

0 comments on commit d89c98a

Please sign in to comment.