Skip to content

Commit

Permalink
implement code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
omerdemirok committed Nov 12, 2023
1 parent 78b05a3 commit 566958a
Show file tree
Hide file tree
Showing 359 changed files with 2,781 additions and 9,163 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go.work
.env
.idea
**/.xatarc
**/fern.config.json

# ignore license header checker
bin/license-header-checker
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ smoke-test: ## smoke tests
@echo "Running test app for sanity check"
@cd internal/smoke-tests && go run . && cd ../..

test: ## run all tests
test: ## run unit tests
@echo "Running unit tests"
@go test -v -count=1 -cover -race ./xata

Expand All @@ -33,3 +33,11 @@ check-license-header: ## Check if all *.py files have a license header
help: ## Display help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
#------------- <https://suva.sh/posts/well-documented-makefiles> --------------

.PHONY: generate-core-code
generate-core-code:
go run xata/internal/code-gen/code_gen.go -scope=core

.PHONY: generate-workspace-code
generate-workspace-code:
go run xata/internal/code-gen/code_gen.go -scope=workspace
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/joho/godotenv v1.5.1
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion internal/docs/sql-openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/docs/workspace-openapi.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions internal/integration-tests/search_filter_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func Test_searchAndFilterClient(t *testing.T) {
assert.NoError(t, err)
if (*aggTableRes.Aggs)["histogram"] != nil &&
(*aggTableRes.Aggs)["histogram"].AggResponseValues != nil {
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
}
return false
}, time.Second*10, time.Second)
Expand All @@ -589,7 +589,7 @@ func Test_searchAndFilterClient(t *testing.T) {
})
assert.NoError(t, err)
if (*aggTableRes.Aggs)["histogram"] != nil && (*aggTableRes.Aggs)["histogram"].AggResponseValues != nil {
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
}
return false
}, time.Second*10, time.Second)
Expand All @@ -613,7 +613,7 @@ func Test_searchAndFilterClient(t *testing.T) {
})
assert.NoError(t, err)
if (*aggTableRes.Aggs)["top_values"] != nil && (*aggTableRes.Aggs)["top_values"].AggResponseValues != nil {
return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values) > 0
return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
}
return false
}, time.Second*10, time.Second)
Expand All @@ -638,7 +638,7 @@ func Test_searchAndFilterClient(t *testing.T) {
})
assert.NoError(t, err)
if (*aggTableRes.Aggs)["num_histogram"] != nil && (*aggTableRes.Aggs)["num_histogram"].AggResponseValues != nil {
return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values) > 0
return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
}
return false
}, time.Second*10, time.Second)
Expand Down
4 changes: 3 additions & 1 deletion xata/branch_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ type BranchRequest struct {
BranchName string
}

type BranchMetadataWS xatagenworkspace.BranchMetadata

type CreateBranchRequestPayload struct {
CreateBranchRequestFrom *string
Metadata *BranchMetadata
Metadata *BranchMetadataWS
}

type CreateBranchRequest struct {
Expand Down
Loading

0 comments on commit 566958a

Please sign in to comment.