Skip to content

Commit

Permalink
Move Swagger to Top Level (PelicanPlatform#1126)
Browse files Browse the repository at this point in the history
* Move Swagger to Top Level
  • Loading branch information
CannonLock authored Apr 16, 2024
1 parent d32b27c commit 699ae2f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ README.dev.md
docs/parameters.json
web_ui/frontend/public/data/parameters.json
local
web_ui/frontend/app/api/docs/pelican-swagger.yaml
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ docs/parameters.json:
@touch docs/parameters.json

.PHONY: generate
generate: docs/parameters.json web_ui/frontend/public/data/parameters.json
generate: docs/parameters.json web_ui/frontend/public/data/parameters.json swagger/pelican-swagger.yaml
ifeq ($(USE_DOCKER),0)
@go generate ./...
else
Expand Down Expand Up @@ -111,7 +111,7 @@ pelican-clean:
@rm -rf $(PELICAN_DIST_PATH)

.PHONY: pelican-build
pelican-build: web_ui/frontend/out/index.html
pelican-build:
@echo PELICAN BUILD
ifeq ($(USE_DOCKER),0)
@goreleaser --clean --snapshot
Expand Down
1 change: 1 addition & 0 deletions generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ func main() {
GenParamEnum()
GenParamStruct()
GenPlaceholderPathForNext()
GenSwaggerDoc()
GenTokenScope()
}
16 changes: 16 additions & 0 deletions generate/next_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ func GenPlaceholderPathForNext() {
}
file.Close()
}

// Copy swagger document from swagger/pelican-swagger.yaml to the web_ui/frontend/app/api directory
func GenSwaggerDoc() {
src := "../swagger/pelican-swagger.yaml"
dst := "../web_ui/frontend/app/api/docs/pelican-swagger.yaml"

swaggerDoc, err := os.ReadFile(src)
if err != nil {
log.Fatalf("error: %v", err)
}

err = os.WriteFile(dst, swaggerDoc, 0644)
if err != nil {
log.Fatalf("error: %v", err)
}
}
File renamed without changes.

0 comments on commit 699ae2f

Please sign in to comment.