Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SDK to include FrontendAPI calls #26

Closed
wants to merge 7 commits into from
33 changes: 24 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GEN_DIR := ./.gen
TARGET_DIR := src/generated
OPENAPI_SPEC_URL := https://api.corbado.com/docs/api/openapi/backend_api_public.yml
TARGET_DIR_BACKEND := src/generated/backendApi
TARGET_DIR_FRONTEND := src/generated/frontendApi
OPENAPI_BACKEND_SPEC_URL := https://api.corbado.com/docs/api/openapi/backend_api_public.yml
OPENAPI_FRONTEND_SPEC_URL := https://api.corbado.com/docs/api/openapi/frontend_api_public.yml
OPENAPI_IMAGE := openapitools/openapi-generator-cli
SOURCE_FILES := $(shell find src/ -type f -name '*.ts')

Expand Down Expand Up @@ -29,20 +31,33 @@ watch:
start: build

.PHONY: openapi_generate
openapi_generate:
@echo "Generating OpenAPI TypeScript Axios code..."
@mkdir -p $(GEN_DIR) $(TARGET_DIR)
@curl -s -o $(GEN_DIR)/backend_api_public.yml $(OPENAPI_SPEC_URL)
openapi_generate: openapi_generate_backendApi openapi_generate_frontendApi

.PHONY: openapi_generate_backendApi
openapi_generate_backendApi:
@echo "Generating OpenAPI Backend TypeScript Axios code..."
@mkdir -p $(GEN_DIR) $(TARGET_DIR_BACKEND)
@curl -s -o $(GEN_DIR)/backend_api_public.yml $(OPENAPI_BACKEND_SPEC_URL)
@docker pull openapitools/openapi-generator-cli
@docker run -v $(GEN_DIR):/local openapitools/openapi-generator-cli generate -g typescript-axios -i /local/backend_api_public.yml -o /local --additional-properties=invokerPackage=Corbado\\Generated
@cp -r $(GEN_DIR)/* $(TARGET_DIR)
@cp -r $(GEN_DIR)/* $(TARGET_DIR_BACKEND)
@rm -rf $(GEN_DIR)
@echo "OpenAPI TypeScript Axios code generation done!"
@echo "OpenAPI TypeScript Axios Backend code generation done!"

.PHONY: openapi_generate_frontendApi
openapi_generate_frontendApi:
@echo "Generating OpenAPI Frontend TypeScript Axios code..."
@mkdir -p $(GEN_DIR) $(TARGET_DIR_FRONTEND)
@curl -s -o $(GEN_DIR)/frontend_api_public.yml $(OPENAPI_FRONTEND_SPEC_URL)
@docker pull openapitools/openapi-generator-cli
@docker run -v $(GEN_DIR):/local openapitools/openapi-generator-cli generate -g typescript-axios -i /local/frontend_api_public.yml -o /local --additional-properties=invokerPackage=Corbado\\Generated
@cp -r $(GEN_DIR)/* $(TARGET_DIR_FRONTEND)
@rm -rf $(GEN_DIR)
@echo "OpenAPI TypeScript Axios Frontend code generation done!"

.PHONY:clean
clean:
rm -rf esm cjs $(TARGET_DIR)
rm -rf esm cjs $(TARGET_DIR_BACKEND)

.PHONY: test
test:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading