Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@
"insert into aws.ec2.volumes(AvailabilityZone, Size, region, TagSpecification) select 'ap-southeast-1a', JSON(10), 'ap-southeast-1', JSON('[ { \"ResourceType\": \"volume\", \"Tag\": [ { \"Key\": \"stack\", \"Value\": \"production\" } ] } ]');"
],
},
{
"name": "DEBUG github pages",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/stackql",
"args": [
"exec",
"--registry=${input:registryString}",
"--auth=${input:authString}",
"--tls.allowInsecure",
"select url from github.repos.pages where owner = 'dummyorg' and repo = 'dummyapp.io' ;"
],
},
{
"name": "DEBUG okta pagination",
"type": "go",
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/aws/aws-sdk-go v1.28.8
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/fatih/color v1.13.0
github.com/getkin/kin-openapi v0.88.0
github.com/google/go-jsonnet v0.17.0
github.com/jackc/pgtype v1.10.0
github.com/jeroenrinzema/psql-wire v0.0.1-stackqlalpha3
Expand All @@ -17,7 +16,7 @@ require (
github.com/spf13/cobra v1.4.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.10.1
github.com/stackql/go-openapistackql v0.0.9-alpha30
github.com/stackql/go-openapistackql v0.0.9-beta01
github.com/stackql/go-sqlite3 v0.0.1-stackqlrc01
github.com/stackql/go-suffix-map v0.0.1-alpha01
go.uber.org/zap v1.21.0
Expand All @@ -37,6 +36,7 @@ require (
github.com/antchfx/xmlquery v1.3.10 // indirect
github.com/antchfx/xpath v1.2.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/getkin/kin-openapi v0.88.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,8 @@ github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
github.com/stackql/color v0.0.1-rc01 h1:fq3Gj6gwskaZnQrDXfFYnDP6JyayGHy6Dp7I5P/V2u0=
github.com/stackql/color v0.0.1-rc01/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/stackql/go-openapistackql v0.0.9-alpha30 h1:dl/4bwfQsAGB7pJWWsBccinlBkTmHC91GC4wBo9ejPE=
github.com/stackql/go-openapistackql v0.0.9-alpha30/go.mod h1:EmwsXQRcFKKJ+9rHpyLq73k62U5LC+9PCdPTZg3cEBg=
github.com/stackql/go-openapistackql v0.0.9-beta01 h1:2yQ4pUbyBICYkXYmKR6anKjjUrBvEEer40YdP0OioNc=
github.com/stackql/go-openapistackql v0.0.9-beta01/go.mod h1:EmwsXQRcFKKJ+9rHpyLq73k62U5LC+9PCdPTZg3cEBg=
github.com/stackql/go-spew v1.1.3-alpha24 h1:yNmgWU+OKU8SvlQ0umiQWWgWS6C5U1GuRMlYfQgbmJA=
github.com/stackql/go-spew v1.1.3-alpha24/go.mod h1:o2MPqg2ee1PN4SxAh9zQSJJmKKFJjpro9pejdK7dXWk=
github.com/stackql/go-sqlite3 v0.0.1-stackqlrc01 h1:q+LfCfPrIqqG5+v9T5xjyYzOEBB4i77Ek10Lzwyd0D4=
Expand Down
7 changes: 3 additions & 4 deletions internal/stackql/httpbuild/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/stackql/stackql/internal/stackql/dto"
"github.com/stackql/stackql/internal/stackql/handler"
"github.com/stackql/stackql/internal/stackql/httpparameters"
"github.com/stackql/stackql/internal/stackql/provider"
"github.com/stackql/stackql/internal/stackql/requests"
"github.com/stackql/stackql/internal/stackql/streaming"
Expand All @@ -37,7 +36,7 @@ func NewExecContext(payload *dto.ExecPayload, rsc *openapistackql.Resource) *Exe

type HTTPArmouryParameters struct {
Header http.Header
Parameters *httpparameters.HttpParameters
Parameters *openapistackql.HttpParameters
Request *http.Request
BodyBytes []byte
}
Expand Down Expand Up @@ -221,12 +220,12 @@ func awsContextHousekeeping(ctx context.Context, svc *openapistackql.Service, pa
return ctx
}

func getRequest(prov *openapistackql.Provider, svc *openapistackql.Service, method *openapistackql.OperationStore, httpParams *httpparameters.HttpParameters) (*http.Request, error) {
func getRequest(prov *openapistackql.Provider, svc *openapistackql.Service, method *openapistackql.OperationStore, httpParams *openapistackql.HttpParameters) (*http.Request, error) {
params, err := httpParams.ToFlatMap()
if err != nil {
return nil, err
}
validationParams, err := method.Parameterize(prov, svc, params, httpParams.RequestBody)
validationParams, err := method.Parameterize(prov, svc, httpParams, httpParams.RequestBody)
if err != nil {
return nil, err
}
Expand Down
153 changes: 0 additions & 153 deletions internal/stackql/httpparameters/http.go

This file was deleted.

13 changes: 4 additions & 9 deletions internal/stackql/requests/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/json"

"github.com/stackql/stackql/internal/stackql/constants"
"github.com/stackql/stackql/internal/stackql/httpparameters"
"github.com/stackql/stackql/internal/stackql/provider"

"github.com/stackql/go-openapistackql/openapistackql"
Expand Down Expand Up @@ -44,8 +43,8 @@ func parseRequestBodyParam(k string, v interface{}) *requestBodyParam {
return nil
}

func SplitHttpParameters(prov provider.IProvider, sqlParamMap map[int]map[string]interface{}, method *openapistackql.OperationStore) ([]*httpparameters.HttpParameters, error) {
var retVal []*httpparameters.HttpParameters
func SplitHttpParameters(prov provider.IProvider, sqlParamMap map[int]map[string]interface{}, method *openapistackql.OperationStore) ([]*openapistackql.HttpParameters, error) {
var retVal []*openapistackql.HttpParameters
var rowKeys []int
requestSchema, _ := method.GetRequestBodySchema()
responseSchema, _ := method.GetRequestBodySchema()
Expand All @@ -55,11 +54,7 @@ func SplitHttpParameters(prov provider.IProvider, sqlParamMap map[int]map[string
sort.Ints(rowKeys)
for _, key := range rowKeys {
sqlRow := sqlParamMap[key]
pr, err := prov.GetProvider()
if err != nil {
return nil, err
}
reqMap := httpparameters.NewHttpParameters(pr, method)
reqMap := openapistackql.NewHttpParameters(method)
for k, v := range sqlRow {
if param, ok := method.GetOperationParameter(k); ok {
reqMap.StoreParameter(param, v)
Expand All @@ -71,7 +66,7 @@ func SplitHttpParameters(prov provider.IProvider, sqlParamMap map[int]map[string
continue
}
}
reqMap.ServerParams[k] = httpparameters.NewParameterBinding(&openapistackql.Parameter{In: "server"}, v)
reqMap.ServerParams[k] = openapistackql.NewParameterBinding(&openapistackql.Parameter{In: "server"}, v)
}
if responseSchema != nil && responseSchema.FindByPath(k, nil) != nil {
reqMap.ResponseBody[k] = v
Expand Down