SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix(dashboards): expose Source as a string enum in the OpenAPI schema (#11930)
Pandeycf69a05f7469
diff --git a/docs/api/openapi.yml b/docs/api/openapi.ymlindex e8913c2660..7776065b81 100644--- a/docs/api/openapi.yml+++ b/docs/api/openapi.yml@@ -3571,7 +3571,7 @@ components:- user- system- integration- type: object+ type: stringDashboardtypesSpanGaps:properties:fillLessThan:diff --git a/pkg/types/dashboardtypes/source.go b/pkg/types/dashboardtypes/source.goindex 97c8e76b4c..9370883c7c 100644--- a/pkg/types/dashboardtypes/source.go+++ b/pkg/types/dashboardtypes/source.go@@ -6,6 +6,7 @@ import ("github.com/SigNoz/signoz/pkg/errors""github.com/SigNoz/signoz/pkg/valuer"+ "github.com/swaggest/jsonschema-go")type Source struct {@@ -22,6 +23,23 @@ func (Source) Enum() []any {return []any{SourceUser, SourceSystem, SourceIntegration}}+// JSONSchema exposes Source as a string enum. Without this the reflector sees the+// unexported valuer.String field and emits `type: object`. The enum values are+// derived from Enum() so the list of sources lives in exactly one place.+func (Source) JSONSchema() (jsonschema.Schema, error) {+ sources := Source{}.Enum()+ enum := make([]any, 0, len(sources))+ for _, source := range sources {+ enum = append(enum, source.(Source).StringValue())+ }++ schema := jsonschema.Schema{}+ schema.WithType(jsonschema.String.Type())+ schema.WithEnum(enum...)++ return schema, nil+}+func (s Source) IsValid() bool {return slices.ContainsFunc(s.Enum(), func(v any) bool { return v == s })}