Skip to content
Open
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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ test:
go test ./...

test_generate:
go run main.go weld openAPI -c tests/csvresponse/foji.yaml
go run main.go weld openAPI -c tests/example/foji.yaml
go run main.go weld openAPI -c tests/auth/foji.yaml
go run main.go weld openAPI openAPIClient -c tests/csvresponse/foji.yaml
go run main.go weld openAPI openAPIClient -c tests/example/foji.yaml
go run main.go weld openAPI openAPIClient -c tests/auth/foji.yaml
cd tests; go run tests_main.go

test_gen: test_generate fmt
Expand All @@ -38,4 +38,4 @@ tools:
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

.PHONY: sqlRepo testSchemaList testStub testDumpConfig lint test test_gen test_generate cover tidy update updateAll install tools
.PHONY: sqlRepo testSchemaList testStub testDumpConfig lint test test_gen test_generate cover tidy update updateAll install tools
13 changes: 13 additions & 0 deletions cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ func (pp ParamMap) HasString(name string) (string, bool) {
return s, ok
}

// GetBool returns a bool param identified by `name`, otherwise false.
// Accepts either a bool or the string "true".
func (pp ParamMap) GetBool(name string) bool {
switch v := pp[name].(type) {
case bool:
return v
case string:
return v == "true"
}

return false
}

// GetWithDefault returns a string param identified by `name`, otherwise returns the default.
func (pp ParamMap) GetWithDefault(name, def string) string {
p, ok := pp[name]
Expand Down
4 changes: 4 additions & 0 deletions foji.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ processes:
params:
Package: github.com/gofoji/foji/test
Auth: github.com/gofoji/foji/test.User
openAPIClient:
params:
Package: github.com/gofoji/foji/test
Auth: github.com/gofoji/foji/test.User
8 changes: 8 additions & 0 deletions foji/foji.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,11 @@ processes:
'service_gen.go': foji/openapi/service.go.tpl
'handlers_gen.go': foji/openapi/handler.go.tpl
'!cmd/serve/main.go': foji/openapi/main.go.tpl
openAPIClient:
format: go
resources: [ api ]
params:
IgnoreGoType: true
OpenAPIFile:
'models_gen.go': foji/openapi/model.go.tpl
'client_gen.go': foji/openapi/client.go.tpl
Loading
Loading