@@ -225,10 +225,10 @@ func (s *ClassificationAPIServer) setupRoutes() *http.ServeMux {
225225}
226226
227227// handleHealth handles health check requests
228- func (s * ClassificationAPIServer ) handleHealth (w http.ResponseWriter , r * http.Request ) {
228+ func (s * ClassificationAPIServer ) handleHealth (w http.ResponseWriter , _ * http.Request ) {
229229 w .Header ().Set ("Content-Type" , "application/json" )
230230 w .WriteHeader (http .StatusOK )
231- w .Write ([]byte (`{"status": "healthy", "service": "classification-api"}` ))
231+ _ , _ = w .Write ([]byte (`{"status": "healthy", "service": "classification-api"}` ))
232232}
233233
234234// APIOverviewResponse represents the response for GET /api/v1
@@ -363,19 +363,15 @@ type OpenAPIComponents struct {
363363}
364364
365365// handleAPIOverview handles GET /api/v1 for API discovery
366- func (s * ClassificationAPIServer ) handleAPIOverview (w http.ResponseWriter , r * http.Request ) {
366+ func (s * ClassificationAPIServer ) handleAPIOverview (w http.ResponseWriter , _ * http.Request ) {
367367 // Build endpoints list from registry, filtering out disabled endpoints
368368 endpoints := make ([]EndpointInfo , 0 , len (endpointRegistry ))
369369 for _ , metadata := range endpointRegistry {
370370 // Filter out system prompt endpoints if they are disabled
371371 if ! s .enableSystemPromptAPI && (metadata .Path == "/config/system-prompts" ) {
372372 continue
373373 }
374- endpoints = append (endpoints , EndpointInfo {
375- Path : metadata .Path ,
376- Method : metadata .Method ,
377- Description : metadata .Description ,
378- })
374+ endpoints = append (endpoints , EndpointInfo (metadata ))
379375 }
380376
381377 response := APIOverviewResponse {
@@ -497,13 +493,13 @@ func (s *ClassificationAPIServer) generateOpenAPISpec() OpenAPISpec {
497493}
498494
499495// handleOpenAPISpec serves the OpenAPI 3.0 specification at /openapi.json
500- func (s * ClassificationAPIServer ) handleOpenAPISpec (w http.ResponseWriter , r * http.Request ) {
496+ func (s * ClassificationAPIServer ) handleOpenAPISpec (w http.ResponseWriter , _ * http.Request ) {
501497 spec := s .generateOpenAPISpec ()
502498 s .writeJSONResponse (w , http .StatusOK , spec )
503499}
504500
505501// handleSwaggerUI serves the Swagger UI at /docs
506- func (s * ClassificationAPIServer ) handleSwaggerUI (w http.ResponseWriter , r * http.Request ) {
502+ func (s * ClassificationAPIServer ) handleSwaggerUI (w http.ResponseWriter , _ * http.Request ) {
507503 // Serve a simple HTML page that loads Swagger UI from CDN
508504 html := `<!DOCTYPE html>
509505<html lang="en">
@@ -545,7 +541,7 @@ func (s *ClassificationAPIServer) handleSwaggerUI(w http.ResponseWriter, r *http
545541
546542 w .Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
547543 w .WriteHeader (http .StatusOK )
548- w .Write ([]byte (html ))
544+ _ , _ = w .Write ([]byte (html ))
549545}
550546
551547// handleIntentClassification handles intent classification requests
@@ -609,7 +605,7 @@ func (s *ClassificationAPIServer) handleSecurityDetection(w http.ResponseWriter,
609605}
610606
611607// Placeholder handlers for remaining endpoints
612- func (s * ClassificationAPIServer ) handleCombinedClassification (w http.ResponseWriter , r * http.Request ) {
608+ func (s * ClassificationAPIServer ) handleCombinedClassification (w http.ResponseWriter , _ * http.Request ) {
613609 s .writeErrorResponse (w , http .StatusNotImplemented , "NOT_IMPLEMENTED" , "Combined classification not implemented yet" )
614610}
615611
@@ -631,7 +627,7 @@ func (s *ClassificationAPIServer) handleBatchClassification(w http.ResponseWrite
631627
632628 // Check if texts field exists in JSON
633629 var rawReq map [string ]interface {}
634- if err := json .Unmarshal (body , & rawReq ); err != nil {
630+ if unmarshalErr := json .Unmarshal (body , & rawReq ); unmarshalErr != nil {
635631 metrics .RecordBatchClassificationError ("unified" , "invalid_json" )
636632 s .writeErrorResponse (w , http .StatusBadRequest , "INVALID_INPUT" , "Invalid JSON format" )
637633 return
@@ -645,9 +641,9 @@ func (s *ClassificationAPIServer) handleBatchClassification(w http.ResponseWrite
645641 }
646642
647643 var req BatchClassificationRequest
648- if err := s .parseJSONRequest (r , & req ); err != nil {
644+ if parseErr := s .parseJSONRequest (r , & req ); parseErr != nil {
649645 metrics .RecordBatchClassificationError ("unified" , "parse_request_failed" )
650- s .writeErrorResponse (w , http .StatusBadRequest , "INVALID_INPUT" , err .Error ())
646+ s .writeErrorResponse (w , http .StatusBadRequest , "INVALID_INPUT" , parseErr .Error ())
651647 return
652648 }
653649
@@ -660,9 +656,9 @@ func (s *ClassificationAPIServer) handleBatchClassification(w http.ResponseWrite
660656 }
661657
662658 // Validate task_type if provided
663- if err := validateTaskType (req .TaskType ); err != nil {
659+ if validateErr := validateTaskType (req .TaskType ); validateErr != nil {
664660 metrics .RecordBatchClassificationError ("unified" , "invalid_task_type" )
665- s .writeErrorResponse (w , http .StatusBadRequest , "INVALID_TASK_TYPE" , err .Error ())
661+ s .writeErrorResponse (w , http .StatusBadRequest , "INVALID_TASK_TYPE" , validateErr .Error ())
666662 return
667663 }
668664
@@ -703,12 +699,12 @@ func (s *ClassificationAPIServer) handleBatchClassification(w http.ResponseWrite
703699 s .writeJSONResponse (w , http .StatusOK , response )
704700}
705701
706- func (s * ClassificationAPIServer ) handleModelsInfo (w http.ResponseWriter , r * http.Request ) {
702+ func (s * ClassificationAPIServer ) handleModelsInfo (w http.ResponseWriter , _ * http.Request ) {
707703 response := s .buildModelsInfoResponse ()
708704 s .writeJSONResponse (w , http .StatusOK , response )
709705}
710706
711- func (s * ClassificationAPIServer ) handleClassifierInfo (w http.ResponseWriter , r * http.Request ) {
707+ func (s * ClassificationAPIServer ) handleClassifierInfo (w http.ResponseWriter , _ * http.Request ) {
712708 if s .config == nil {
713709 s .writeJSONResponse (w , http .StatusOK , map [string ]interface {}{
714710 "status" : "no_config" ,
@@ -726,7 +722,7 @@ func (s *ClassificationAPIServer) handleClassifierInfo(w http.ResponseWriter, r
726722
727723// handleOpenAIModels handles OpenAI-compatible model listing at /v1/models
728724// It returns all models discoverable from the router configuration plus a synthetic "auto" model.
729- func (s * ClassificationAPIServer ) handleOpenAIModels (w http.ResponseWriter , r * http.Request ) {
725+ func (s * ClassificationAPIServer ) handleOpenAIModels (w http.ResponseWriter , _ * http.Request ) {
730726 now := time .Now ().Unix ()
731727
732728 // Start with the special "auto" model always available from the router
@@ -763,15 +759,15 @@ func (s *ClassificationAPIServer) handleOpenAIModels(w http.ResponseWriter, r *h
763759 s .writeJSONResponse (w , http .StatusOK , resp )
764760}
765761
766- func (s * ClassificationAPIServer ) handleClassificationMetrics (w http.ResponseWriter , r * http.Request ) {
762+ func (s * ClassificationAPIServer ) handleClassificationMetrics (w http.ResponseWriter , _ * http.Request ) {
767763 s .writeErrorResponse (w , http .StatusNotImplemented , "NOT_IMPLEMENTED" , "Classification metrics not implemented yet" )
768764}
769765
770- func (s * ClassificationAPIServer ) handleGetConfig (w http.ResponseWriter , r * http.Request ) {
766+ func (s * ClassificationAPIServer ) handleGetConfig (w http.ResponseWriter , _ * http.Request ) {
771767 s .writeErrorResponse (w , http .StatusNotImplemented , "NOT_IMPLEMENTED" , "Get config not implemented yet" )
772768}
773769
774- func (s * ClassificationAPIServer ) handleUpdateConfig (w http.ResponseWriter , r * http.Request ) {
770+ func (s * ClassificationAPIServer ) handleUpdateConfig (w http.ResponseWriter , _ * http.Request ) {
775771 s .writeErrorResponse (w , http .StatusNotImplemented , "NOT_IMPLEMENTED" , "Update config not implemented yet" )
776772}
777773
@@ -1096,7 +1092,7 @@ type SystemPromptUpdateRequest struct {
10961092}
10971093
10981094// handleGetSystemPrompts handles GET /config/system-prompts
1099- func (s * ClassificationAPIServer ) handleGetSystemPrompts (w http.ResponseWriter , r * http.Request ) {
1095+ func (s * ClassificationAPIServer ) handleGetSystemPrompts (w http.ResponseWriter , _ * http.Request ) {
11001096 cfg := s .config
11011097 if cfg == nil {
11021098 http .Error (w , "Configuration not available" , http .StatusInternalServerError )
0 commit comments