Skip to content

Commit

Permalink
Merge branch 'chore/operationid' into 'main'
Browse files Browse the repository at this point in the history
Chore/operationid

See merge request decidim/decidim-chatbot/decidim-module-rest_full!11
  • Loading branch information
Hadrien Froger committed Dec 10, 2024
2 parents 424614e + f46a3af commit 644138b
Show file tree
Hide file tree
Showing 20 changed files with 7,896 additions and 1,841 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
decidim-rest_full (0.0.5)
decidim-rest_full (0.0.6)
api-pagination (~> 6.0)
cancancan
decidim-admin (>= 0.28, < 0.30)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ To run these scripts, change your current branch to `main` and do:
Release a patch
```
yarn version --new-version patch --no-git-tag-version
yarn postversion
git add .
git tag v0.0.<yourpatch>
```

Release a minor
```
yarn version minor
yarn postversion
git add .
git tag $(yarn postversion)
```
Expand Down
69 changes: 64 additions & 5 deletions bin/swaggerize
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
#! /bin/bash
#!/bin/bash
set -e
echo -n "generating openapi spec .................................. "
SWAGGER_DRY_RUN=0 bundle exec rspec spec/decidim/rest_full/**/*_spec.rb --format Rswag::Specs::SwaggerFormatter --order defined > /dev/null 2>&1
mv -f spec/decidim_dummy_app/swagger/v1/swagger.json ./website/static/openapi.json > /dev/null 2>&1
echo "ok"

# Default values for options
QUIET=0
OUTPUT_FILE="./openapi.json"

# Print messages unless quiet mode is active
log() {
if [[ $QUIET -eq 0 ]]; then
echo "$@"
fi
}

# Help menu
show_help() {
cat <<EOF
Usage: $0 [options]
Options:
--quiet, -q Suppress output messages.
--out, -o FILE Specify the output file (default: $OUTPUT_FILE).
--help, -h Display this help menu.
EOF
}

# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--quiet|-q)
QUIET=1
shift
;;
--out|-o)
OUTPUT_FILE="$2"
shift 2
;;
--help|-h)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done

log "Generating OpenAPI spec"
log "~~~~~~~~~~~~~~~~~~~~~~~"
log "quiet: $QUIET"
log "output: $OUTPUT_FILE"
log "~~~~~~~~~~~~~~~~~~~~~~~"

if [[ $QUIET -eq 1 ]]; then
SWAGGER_DRY_RUN=0 bundle exec rspec spec/decidim/rest_full/**/*_spec.rb \
--format Rswag::Specs::SwaggerFormatter --order defined > /dev/null 2>&1
else
SWAGGER_DRY_RUN=0 bundle exec rspec spec/decidim/rest_full/**/*_spec.rb \
--format Rswag::Specs::SwaggerFormatter --order defined
fi

mv -f spec/decidim_dummy_app/swagger/v1/swagger.json "$OUTPUT_FILE"
log "done, $OUTPUT_FILE written."
Loading

0 comments on commit 644138b

Please sign in to comment.