add swagger
All checks were successful
All checks were successful
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,3 +20,4 @@ yarn-error.log
|
|||||||
/public/modules/*
|
/public/modules/*
|
||||||
.qodo
|
.qodo
|
||||||
.camel-jbang
|
.camel-jbang
|
||||||
|
dump/
|
||||||
@@ -53,7 +53,8 @@
|
|||||||
"mockery/mockery": "^1.4.4",
|
"mockery/mockery": "^1.4.4",
|
||||||
"nunomaduro/collision": "^7.0",
|
"nunomaduro/collision": "^7.0",
|
||||||
"phpunit/phpunit": "^10.1",
|
"phpunit/phpunit": "^10.1",
|
||||||
"spatie/laravel-ignition": "^2.0"
|
"spatie/laravel-ignition": "^2.0",
|
||||||
|
"knuckleswtf/scribe": "5.9.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
@@ -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
|
# Run composer install to physically ensure all files (like laravel/prompts) are present in the volume
|
||||||
composer install --no-interaction --optimize-autoloader
|
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
|
# FIX: Ensure all generated/downloaded files are fully readable and executable
|
||||||
echo "Setting correct ownership for web server..."
|
echo "Setting correct ownership for web server..."
|
||||||
chown -R www-data:www-data vendor
|
chown -R www-data:www-data vendor
|
||||||
|
|||||||
Reference in New Issue
Block a user