Skip to content

Commit

Permalink
Update generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
corbadovych committed Jul 4, 2024
1 parent 604b3aa commit 690daaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ tasks:
- docker-build
desc: Generates OpenAPI entities and clients
cmds:
- docker run -it -v $(pwd):/app corbado-go:latest scripts/generate-openapi.sh pkg/sdk/entity/api
- docker run -it -v $(pwd):/app corbado-go:latest scripts/generate-openapi.sh pkg/generated
11 changes: 4 additions & 7 deletions scripts/generate-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

if [ $# -ne 1 ]; then
echo "USAGE: <output path>"
echo "EXAMPLE: pkg/sdk/entity/api"
echo "EXAMPLE: pkg/generated"

exit 1
fi

path=$1

# download OpenAPI specs
curl -s -O https://api.corbado.com/docs/api/openapi/backend_api_public.yml
# To generate openapi client, you need to copy common.yml and backend_api_public.yml to the root of the project

# generate Go entities and clients
oapi-codegen -package api -generate "types,client" backend_api_public.yml > ${path}/api.gen.go

# remove OpenAPI specs
rm backend_api_public.yml
oapi-codegen -package common -generate "types" common.yml > ${path}/common/common.gen.go
oapi-codegen -package api -import-mapping common.yml:github.com/corbado/corbado-go/pkg/generated/common -generate "types,client" backend_api_public.yml > ${path}/api/api.gen.go

0 comments on commit 690daaf

Please sign in to comment.