1.2 KiB
1.2 KiB
SwaggerUI
Özet: Fiber v3 native Swagger UI entegrasyonu (main.go:79). OpenAPI spec docs/swagger.json dosyasından statik olarak servis edilir, UI CDN'den (unpkg) yüklenir.
Kütüphaneler: swaggo/swag, Swagger UI 5.x (CDN)
Route'lar
| Path | Açıklama |
|---|---|
GET /swagger |
/swagger/'a redirect |
GET /swagger/ |
Swagger UI HTML (CDN) |
GET /swagger/swagger.json |
Statik OpenAPI spec dosyası |
Kullanım
# Swagger spec'i yenile
swag init
# Swagger UI'a tarayıcıdan eriş
open http://localhost:8000/swagger/
Swagger Annotation'ları
main.go:1-19— Genel API bilgisi (title, version, host, security)handlers/health.go:21-27—/healthendpointhandlers/openai.go:20-28—/v1/{path}endpointhandlers/anthropic.go:65-73—/anthropic/{path}endpoint
Önemli Detaylar
- Swagger UI unpkg CDN'inden yüklenir (offline çalışmaz)
- Spec statik dosyadır:
docs/swagger.json docs/swagger.yamlda mevcuttur (aynı spec)swag inither endpoint/değişiklik sonrası çalıştırılmalıdır- API key:
Authorization: Bearer(Swagger UI'da "Authorize" butonu)