-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REWRITE: replace Netlify API code generation tool
- Loading branch information
Showing
604 changed files
with
111,617 additions
and
65,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Terraform Provider", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
// this assumes your workspace is the root of the repo | ||
"program": "${workspaceFolder}", | ||
"env": {}, | ||
"args": [ | ||
"-debug", | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"go.lintFlags": [ | ||
"--fast" | ||
], | ||
"go.lintTool": "golangci-lint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
.PHONY: all build deps generate help test validate | ||
.PHONY: all build deps generate help test openapi_generate | ||
SWAGGER_SPEC=swagger.yml | ||
|
||
help: ## Show this help. | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
all: deps generate test testacc # build ## Validate the swagger spec, generate the code and build it. | ||
all: deps openapi_generate generate test testacc # build | ||
|
||
# build: ## Build the API Go client. | ||
# go build ./go/... | ||
# build: ## Build Terraform provider. | ||
# go build ??? | ||
|
||
deps: ## Download dependencies. | ||
deps: ## Install dependencies. | ||
go mod download | ||
|
||
generate: validate ## Generate the API Go client and the JSON document for the UI. | ||
generate: ## Generate Terraform docs. | ||
go generate | ||
|
||
openapi_generate: ## Generate the go code from the OpenAPI spec. | ||
docker run --rm \ | ||
-v ${PWD}:/local openapitools/openapi-generator-cli generate \ | ||
--additional-properties=disallowAdditionalPropertiesIfNotPresent=false,isGoSubmodule=true,packageName=netlifyapi,withGoMod=false \ | ||
--global-property apiDocs=false,modelDocs=false,apiTests=false,modelTests=false \ | ||
-i /local/openapi.json \ | ||
-g go \ | ||
-o /local/internal/netlifyapi ; \ | ||
sed -i '' 's/int32/int64/g' internal/netlifyapi/model_*.go ; \ | ||
sed -i '' 's/int32/int64/g' internal/netlifyapi/api_*.go | ||
|
||
test: ## Test the go code. | ||
go test -v ./... | ||
|
||
testacc: | ||
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m | ||
|
||
validate: deps ## Check that the swagger spec is valid. | ||
go run github.com/go-swagger/go-swagger/cmd/swagger validate $(SWAGGER_SPEC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Updating swagger.yml | ||
|
||
**This is a temporary measure. Feedback will be shared to fix upstream.** | ||
|
||
This project uses a modified `openapi.json`. Please maintain these instructions and follow them carefully. | ||
|
||
1. Take the latest `openapi-external.json` from [netlify/bitballoon-openapi](https://github.dev/netlify/bitballoon-openapi/blob/main/openapi-external.json). | ||
1. Remove the billing_details property from the `Account` object (also from the `required` array). | ||
1. Fix the type of `Repo.base_rel_dir` to `boolean`. | ||
1. Remove all required properties from the `Repo` object (manual builds). | ||
1. Remove the `domain` property from the `required` array of the `DnsZone` object. | ||
1. Remove the `values`, `scopes` and `is_secret` parameters from the `updateEnvVar` operation. | ||
1. Add a request body schema to the `updateEnvVar` operation, by copying it from an earlier version of the `openapi.json`. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.