Files
Beyhan Ogur a408821410 first commit
2026-05-11 15:08:50 +03:00

41 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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)
**Bağlantılar:** [[Main]], [[Index]]
## 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
```bash
# 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``/health` endpoint
- `handlers/openai.go:20-28``/v1/{path}` endpoint
- `handlers/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.yaml` da mevcuttur (aynı spec)
- `swag init` her endpoint/değişiklik sonrası çalıştırılmalıdır
- API key: `Authorization: Bearer` (Swagger UI'da "Authorize" butonu)