Skip to content

Commit

Permalink
Feature/openapi3 (#1667)
Browse files Browse the repository at this point in the history
* wip

* merge

* openapi3

* lint fixes

* better error handling and return no content when needed

* remove python swagger validator - supports only version 2

* fix compilation

* do not set content type if no response payload

* check the right status code for delete repository

* fix system tests

* remove swagger variables and add extention to exclude specific
validation

* code review fixes

* fix upload

* oapi validation error use the same json error response format

* auth middileware checks return error

* merge two metrics handlers

* supply swagger spec

* code review changes

* document the reason we added OapiRequestValidatorWithOptions

* nessie upload object code update

* fix benchmarks upload

* loadtest default client endpoint and better error message

* make merge body optional for compatibility

* fix lakectl output templates and reuse api base url

* return status code on auth attach detach

* logging and remove unused

* better errors

* fix ID field case

* code review changes

* max per page documentation

* better error handling

* fix commit log metadata access from go template

* code review changes

* commit log support for old clients

* fix struct names for lakectl templates

* log actions check branch name is not empty

* deprecated comment

* add todo
  • Loading branch information
nopcoder authored Apr 1, 2021
1 parent 933ec25 commit 6a01ee3
Show file tree
Hide file tree
Showing 90 changed files with 8,189 additions and 9,119 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
# Generated files
*.gen.go

### Go Patch ###
/vendor/
Expand Down
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
run:
tests: false
skip-dirs:
- api/gen
- metastore/give/gen-go
- pkg/metastore/give/gen-go
timeout: 5m

linters:
Expand Down
34 changes: 13 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ NPM=$(or $(shell which npm), $(error "Missing dependency - no npm in PATH"))
PROTOC_IMAGE="treeverse/protoc:3.14.0"
PROTOC=$(DOCKER) run --rm -v $(shell pwd):/mnt $(PROTOC_IMAGE)

# Same for python swagger validation
SWAGGER_VALIDATOR_IMAGE=treeverse/swagger-spec-validator:latest
SWAGGER_VALIDATOR=$(DOCKER) run --rm -v $(shell pwd):/mnt $(SWAGGER_VALIDATOR_IMAGE)

export PATH:= $(PATH):$(GOBINPATH)

GOBUILD=$(GOCMD) build
Expand All @@ -30,7 +26,6 @@ LAKECTL_BINARY_NAME=lakectl

UI_DIR=webui
UI_BUILD_DIR=$(UI_DIR)/build
API_BUILD_DIR=pkg/api/gen

DOCKER_IMAGE=lakefs
DOCKER_TAG=dev
Expand All @@ -48,8 +43,16 @@ export REVISION
all: build

clean:
@rm -rf $(API_BUILD_DIR) $(UI_BUILD_DIR) ddl/statik.go statik $(LAKEFS_BINARY_NAME) $(LAKECTL_BINARY_NAME) \
graveler/committed/mock graveler/sstable/mock actions/mock
@rm -rf \
$(LAKECTL_BINARY_NAME) \
$(LAKEFS_BINARY_NAME) \
$(UI_BUILD_DIR) \
pkg/actions/mock \
pkg/api/lakefs.gen.go \
pkg/ddl/statik.go \
pkg/graveler/sstable/mock \
pkg/webui \
pkg/graveler/committed/mock

check-licenses: check-licenses-go-mod check-licenses-npm

Expand Down Expand Up @@ -81,20 +84,16 @@ go-mod-download: ## Download module dependencies
$(GOCMD) mod download

go-install: go-mod-download ## Install dependencies
$(GOCMD) install github.com/go-swagger/go-swagger/cmd/swagger
$(GOCMD) install github.com/deepmap/oapi-codegen/cmd/oapi-codegen
$(GOCMD) install github.com/golang/mock/mockgen
$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint
$(GOCMD) install github.com/rakyll/statik
$(GOCMD) install google.golang.org/protobuf/cmd/protoc-gen-go


gen-api: go-install del-gen-api ## Run the go-swagger code generator
gen-api: go-install ## Run the swagger code generator
$(GOGENERATE) ./pkg/api

del-gen-api:
@rm -rf $(API_BUILD_DIR)
@mkdir -p $(API_BUILD_DIR)

.PHONY: gen-mockgen
gen-mockgen: go-install ## Run the generator for inline commands
$(GOGENERATE) ./pkg/graveler/sstable
Expand All @@ -103,13 +102,6 @@ gen-mockgen: go-install ## Run the generator for inline commands
$(GOGENERATE) ./pkg/onboard
$(GOGENERATE) ./pkg/actions

validate-swagger: go-install ## Validate swagger.yaml
$(GOBINPATH)/swagger validate api/swagger.yml
# Run python validation as well
$(GOBINPATH)/swagger expand --format=json api/swagger.yml > swagger.json
$(SWAGGER_VALIDATOR) /mnt/swagger.json
@rm swagger.json

LD_FLAGS := "-X github.com/treeverse/lakefs/pkg/config.Version=$(VERSION)-$(REVISION)"
build: gen docs ## Download dependencies and build the default binary
$(GOBUILD) -o $(LAKEFS_BINARY_NAME) -ldflags $(LD_FLAGS) -v ./cmd/$(LAKEFS_BINARY_NAME)
Expand Down Expand Up @@ -157,7 +149,7 @@ validate-proto: proto ## build proto and check if diff found
git diff --quiet -- pkg/graveler/committed/committed.pb.go
git diff --quiet -- pkg/graveler/graveler.pb.go

checks-validator: lint validate-fmt validate-swagger validate-proto ## Run all validation/linting steps
checks-validator: lint validate-fmt validate-proto ## Run all validation/linting steps

$(UI_DIR)/node_modules:
cd $(UI_DIR) && $(NPM) install
Expand Down
Loading

0 comments on commit 6a01ee3

Please sign in to comment.