Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.travis.yml
test/
git_push.sh

go.mod
api/
.gitignore
3 changes: 0 additions & 3 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.gitignore
README.md
api/openapi.yaml
api_access_rules.go
api_apps.go
api_bundles.go
Expand Down Expand Up @@ -255,7 +253,6 @@ docs/UserList.md
docs/UsersAPI.md
docs/VisibilityInfo.md
docs/VisibilityTypeEnum.md
go.mod
go.sum
model_access.go
model_access_list.go
Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
SHELL := /bin/bash

OPENAPI_GEN=openapi-generator generate -i api/openapi.yaml -g go -o . -c config.json
OPENAPI_GEN_CI=openapi-generator-cli generate --enable-post-process-file -i api/openapi.yaml -g go -o . -c config.json
OPENAPI_GEN=openapi-generator generate --additional-properties=disallowAdditionalPropertiesIfNotPresent=false -i api/openapi.yaml -g go -o . -c config.json
OPENAPI_GEN_CI=openapi-generator-cli generate --additional-properties=disallowAdditionalPropertiesIfNotPresent=false --enable-post-process-file -i api/openapi.yaml -g go -o . -c config.json
PULL_REMOTE_OPENAPI=curl https://app.opal.dev/openapi.yaml > api/openapi.yaml
CLEAN=bash clean.sh
CLEAN_CI=CI=true bash clean.sh

gen-openapi:
$(OPENAPI_GEN)
$(CLEAN)
gen-openapi-remote:
$(PULL_REMOTE_OPENAPI)
$(OPENAPI_GEN)
$(CLEAN)
gen-openapi-remote-for-ci:
$(PULL_REMOTE_OPENAPI)
$(OPENAPI_GEN_CI)
$(CLEAN_CI)
clean:
$(CLEAN)
clean-ci:
$(CLEAN_CI)
66 changes: 66 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

# Check for CI parameter
CI_MODE=false
if [[ "$1" == "CI=true" ]] || [[ "$CI" == "true" ]]; then
CI_MODE=true
fi

# Dynamically find Go files not in .openapi-generator/FILES
files=()
for file in *.go; do
if [ -f "$file" ]; then
# Check if file is NOT in the FILES list
if ! grep -qx "$file" .openapi-generator/FILES; then
files+=("$file")
fi
fi
done

# Check if any unlisted files were found
if [ ${#files[@]} -eq 0 ]; then
echo "All Go files are listed in .openapi-generator/FILES"
exit 0
fi

echo "Go files not in .openapi-generator/FILES:"
echo "========================================="
for file in "${files[@]}"; do
echo " - $file"
done
echo ""
echo "Total: ${#files[@]} file(s)"
echo ""

# If CI mode, automatically delete. Otherwise, ask user
if [ "$CI_MODE" = true ]; then
echo "CI mode enabled - automatically deleting files..."
for file in "${files[@]}"; do
if [ -f "$file" ]; then
rm "$file"
echo " Deleted: $file"
else
echo " Not found: $file"
fi
done
echo "Done!"
else
# Ask user if they want to delete these files
read -p "Do you want to delete these files? (y/N): " -n 1 -r
echo ""

if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Deleting files..."
for file in "${files[@]}"; do
if [ -f "$file" ]; then
rm "$file"
echo " Deleted: $file"
else
echo " Not found: $file"
fi
done
echo "Done!"
else
echo "No files were deleted."
fi
fi
34 changes: 0 additions & 34 deletions common.go

This file was deleted.

4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ go 1.18
require (
gopkg.in/validator.v2 v2.0.1
)

retract (
v1.1.1 // cannot be installed on macos
)
25 changes: 21 additions & 4 deletions model_access.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions model_access_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions model_access_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading