add swagger
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m28s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 38s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
eko
2026-04-12 22:06:46 +07:00
parent 75ece668cc
commit ac2ec6e659
3 changed files with 40 additions and 2 deletions

3
.gitignore vendored
View File

@@ -19,4 +19,5 @@ yarn-error.log
/storage/framework/views/*
/public/modules/*
.qodo
.camel-jbang
.camel-jbang
dump/

View File

@@ -53,7 +53,8 @@
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
"spatie/laravel-ignition": "^2.0",
"knuckleswtf/scribe": "5.9.0"
},
"autoload": {
"psr-4": {

View File

@@ -84,6 +84,42 @@ echo "Verifying and synchronizing Composer dependencies..."
# Run composer install to physically ensure all files (like laravel/prompts) are present in the volume
composer install --no-interaction --optimize-autoloader
# Add after the "composer install --no-interaction --optimize-autoloader" line
# Install and publish Scribe assets
echo "Setting up Scribe/OpenAPI documentation..."
# Publish Scribe config (if not already published)
if [ ! -f config/scribe.php ]; then
echo "Publishing Scribe configuration..."
php artisan vendor:publish --tag=scribe-config --force
fi
# Generate OpenAPI/Swagger documentation
if [ "$APP_ENV" != "production" ] || [ "$AUTO_GENERATE_API_DOCS" = "true" ]; then
echo "Generating API documentation..."
# Generate Scribe documentation
php artisan scribe:generate --no-interaction || echo "⚠️ Scribe generation failed, check your API routes"
# For OpenAPI/Swagger UI specifically
if [ -f public/docs/openapi.yaml ] || [ -f public/docs/collection.json ]; then
echo "✅ Documentation generated successfully"
echo "📚 Swagger UI available at: /docs (if configured)"
echo "📄 OpenAPI spec available at: /docs/openapi.yaml"
else
echo "⚠️ Documentation files not found after generation"
fi
fi
# Create symbolic link for Scribe assets if needed
if [ -d vendor/knuckleswtf/scribe/dist ]; then
echo "Creating Scribe assets symlink..."
mkdir -p public/vendor/scribe
cp -r vendor/knuckleswtf/scribe/dist/* public/vendor/scribe/ 2>/dev/null || \
ln -sf ../vendor/knuckleswtf/scribe/dist public/vendor/scribe 2>/dev/null || true
fi
# FIX: Ensure all generated/downloaded files are fully readable and executable
echo "Setting correct ownership for web server..."
chown -R www-data:www-data vendor