mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Add rebuild-doc-api util to regenerate swagger stuff
This commit is contained in:
parent
646e449995
commit
618d46aadb
1 changed files with 27 additions and 1 deletions
26
ynh-dev
26
ynh-dev
|
@ -24,6 +24,8 @@ function show_usage() {
|
|||
add Add the custom catalog in Yunohost catalog list
|
||||
override Override default catalog with the custom catalog
|
||||
reset Reset the catalog list to Yunohost's default
|
||||
|
||||
rebuild-api-doc Rebuild the API swagger doc
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -49,6 +51,8 @@ function main()
|
|||
|
||||
catalog|--catalog) catalog $ARGUMENTS ;;
|
||||
|
||||
rebuild-api-doc|--rebuild-api-doc) rebuild_api_doc $ARGUMENTS ;;
|
||||
|
||||
*) critical "Unknown action ${ACTION}." ;;
|
||||
esac
|
||||
}
|
||||
|
@ -526,4 +530,26 @@ function catalog()
|
|||
esac
|
||||
}
|
||||
|
||||
function rebuild_api_doc()
|
||||
{
|
||||
test -d yunohost || critical "Expected to find a 'yunohost' folder ?"
|
||||
|
||||
cd yunohost/doc
|
||||
|
||||
if ! test -d swagger
|
||||
then
|
||||
# Download swagger ui
|
||||
info "Downloading swagger UI"
|
||||
curl -L https://github.com/swagger-api/swagger-ui/archive/refs/tags/v4.15.5.tar.gz | tar -xvz swagger-ui-4.15.5/dist/;
|
||||
mv swagger-ui-4.15.5/dist/ swagger
|
||||
rmdir swagger-ui-4.15.5
|
||||
fi
|
||||
|
||||
info "Rebuild swagger json/js according to actionsmap"
|
||||
python3 generate_api_doc.py
|
||||
success "You should now open yunohost/doc/api.html using your favorite browser"
|
||||
}
|
||||
|
||||
|
||||
|
||||
main $@
|
||||
|
|
Loading…
Add table
Reference in a new issue