Skip to content

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.

chore: add openapi check for js and regenerate (#10249)

Srikanth Chekuricd014652a15f
diff --git a/.github/workflows/goci.yaml b/.github/workflows/goci.yaml
index 3838973c5b..83070bde0b 100644
--- a/.github/workflows/goci.yaml
+++ b/.github/workflows/goci.yaml
@@ -93,3 +93,13 @@ jobs:
run: |
go run cmd/enterprise/*.go generate openapi
git diff --compact-summary --exit-code || (echo; echo "Unexpected difference in openapi spec. Run go run cmd/enterprise/*.go generate openapi locally and commit."; exit 1)
+ - name: node-install
+ uses: actions/setup-node@v5
+ with:
+ node-version: "22"
+ - name: install-frontend
+ run: cd frontend && yarn install
+ - name: generate-api-clients
+ run: |
+ cd frontend && yarn generate:api
+ git diff --compact-summary --exit-code || (echo; echo "Unexpected difference in generated api clients. Run yarn generate:api in frontend/ locally and commit."; exit 1)
diff --git a/docs/api/openapi.yml b/docs/api/openapi.yml
index ed0028558b..ac66ef09cd 100644
--- a/docs/api/openapi.yml
+++ b/docs/api/openapi.yml
@@ -4355,6 +4355,8 @@ components:
type: string
unit:
type: string
+ required:
+ - name
type: object
Querybuildertypesv5QueryData:
properties:
@@ -4427,6 +4429,9 @@ components:
type: array
nullable: true
type: object
+ required:
+ - keys
+ - complete
type: object
TelemetrytypesGettableFieldValues:
properties:
@@ -4434,6 +4439,9 @@ components:
type: boolean
values:
$ref: '#/components/schemas/TelemetrytypesTelemetryFieldValues'
+ required:
+ - values
+ - complete
type: object
TelemetrytypesTelemetryFieldKey:
properties:
@@ -4449,6 +4457,8 @@ components:
type: string
unit:
type: string
+ required:
+ - name
type: object
TelemetrytypesTelemetryFieldValues:
properties:
diff --git a/frontend/package.json b/frontend/package.json
index 82edff0d90..6029a6431b 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -19,7 +19,7 @@
"commitlint": "commitlint --edit $1",
"test": "jest",
"test:changedsince": "jest --changedSince=main --coverage --silent",
- "generate:api": "orval --config ./orval.config.ts && sh scripts/post-types-generation.sh && prettier --write src/api/generated && (eslint --fix src/api/generated || true)"
+ "generate:api": "orval --config ./orval.config.ts && sh scripts/post-types-generation.sh"
},
"engines": {
"node": ">=16.15.0"
diff --git a/frontend/scripts/post-types-generation.sh b/frontend/scripts/post-types-generation.sh
index 0feb86fcf4..736d990fd1 100755
--- a/frontend/scripts/post-types-generation.sh
+++ b/frontend/scripts/post-types-generation.sh
@@ -1,5 +1,6 @@
#!/bin/bash
+echo "\n\n---\nRenamed tag files to index.ts...\n"
# Rename tag files to index.ts in services directories
# tags-split creates: services/tagName/tagName.ts -> rename to services/tagName/index.ts
find src/api/generated/services -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
@@ -11,4 +12,33 @@ find src/api/generated/services -mindepth 1 -maxdepth 1 -type d | while read -r
fi
done
-echo "Tag files renamed to index.ts"
+echo "\n✅ Tag files renamed to index.ts"
+
+# Format generated files
+echo "\n\n---\nRunning prettier...\n"
+if ! prettier --write src/api/generated; then
+ echo "Prettier formatting failed!"
+ exit 1
+fi
+echo "\n✅ Prettier formatting successful"
+
+
+# Fix linting issues
+echo "\n\n---\nRunning eslint...\n"
+if ! yarn lint --fix --quiet src/api/generated; then
+ echo "ESLint check failed! Please fix linting errors before proceeding."
+ exit 1
+fi
+echo "\n✅ ESLint check successful"
+
+
+# Check for type errors
+echo "\n\n---\nChecking for type errors...\n"
+if ! tsc --noEmit; then
+ echo "Type check failed! Please fix type errors before proceeding."
+ exit 1
+fi
+echo "\n✅ Type check successful"
+
+
+echo "\n\n---\n ✅✅✅ API generation complete!"
diff --git a/frontend/src/api/generated/services/fields/index.ts b/frontend/src/api/generated/services/fields/index.ts
new file mode 100644
index 0000000000..ec63e5d92f
--- /dev/null
+++ b/frontend/src/api/generated/services/fields/index.ts
@@ -0,0 +1,222 @@
+/**
+ * ! Do not edit manually
+ * * The file has been auto-generated using Orval for SigNoz
+ * * regenerate with 'yarn generate:api'
+ * SigNoz
+ */
+import type {
+ InvalidateOptions,
+ QueryClient,
+ QueryFunction,
+ QueryKey,
+ UseQueryOptions,
+ UseQueryResult,
+} from 'react-query';
+import { useQuery } from 'react-query';
+
+import { GeneratedAPIInstance } from '../../../index';
+import type {
+ GetFieldsKeys200,
+ GetFieldsKeysParams,
+ GetFieldsValues200,
+ GetFieldsValuesParams,
+ RenderErrorResponseDTO,
+} from '../sigNoz.schemas';
+
+type AwaitedInput<T> = PromiseLike<T> | T;
+
+type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
+
+/**
+ * This endpoint returns field keys
+ * @summary Get field keys
+ */
+export const getFieldsKeys = (
+ params?: GetFieldsKeysParams,
+ signal?: AbortSignal,
+) => {
+ return GeneratedAPIInstance<GetFieldsKeys200>({
+ url: `/api/v1/fields/keys`,
+ method: 'GET',
+ params,
+ signal,
+ });
+};
+
+export const getGetFieldsKeysQueryKey = (params?: GetFieldsKeysParams) => {
+ return ['getFieldsKeys', ...(params ? [params] : [])] as const;
+};
+
+export const getGetFieldsKeysQueryOptions = <
+ TData = Awaited<ReturnType<typeof getFieldsKeys>>,
+ TError = RenderErrorResponseDTO
+>(
+ params?: GetFieldsKeysParams,
+ options?: {
+ query?: UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsKeys>>,
+ TError,
+ TData
+ >;
+ },
+) => {
+ const { query: queryOptions } = options ?? {};
+
+ const queryKey = queryOptions?.queryKey ?? getGetFieldsKeysQueryKey(params);
+
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getFieldsKeys>>> = ({
+ signal,
+ }) => getFieldsKeys(params, signal);
+
+ return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsKeys>>,
+ TError,
+ TData
+ > & { queryKey: QueryKey };
+};
+
+export type GetFieldsKeysQueryResult = NonNullable<
+ Awaited<ReturnType<typeof getFieldsKeys>>
+>;
+export type GetFieldsKeysQueryError = RenderErrorResponseDTO;
+
+/**
+ * @summary Get field keys
+ */
+
+export function useGetFieldsKeys<
+ TData = Awaited<ReturnType<typeof getFieldsKeys>>,
+ TError = RenderErrorResponseDTO
+>(
+ params?: GetFieldsKeysParams,
+ options?: {
+ query?: UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsKeys>>,
+ TError,
+ TData
+ >;
+ },
+): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
+ const queryOptions = getGetFieldsKeysQueryOptions(params, options);
+
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
+ queryKey: QueryKey;
+ };
+
+ query.queryKey = queryOptions.queryKey;
+
+ return query;
+}
+
+/**
+ * @summary Get field keys
+ */
+export const invalidateGetFieldsKeys = async (
+ queryClient: QueryClient,
+ params?: GetFieldsKeysParams,
+ options?: InvalidateOptions,
+): Promise<QueryClient> => {
+ await queryClient.invalidateQueries(
+ { queryKey: getGetFieldsKeysQueryKey(params) },
+ options,
+ );
+
+ return queryClient;
+};
+
+/**
+ * This endpoint returns field values
+ * @summary Get field values
+ */
+export const getFieldsValues = (
+ params?: GetFieldsValuesParams,
+ signal?: AbortSignal,
+) => {
+ return GeneratedAPIInstance<GetFieldsValues200>({
+ url: `/api/v1/fields/values`,
+ method: 'GET',
+ params,
+ signal,
+ });
+};
+
+export const getGetFieldsValuesQueryKey = (params?: GetFieldsValuesParams) => {
+ return ['getFieldsValues', ...(params ? [params] : [])] as const;
+};
+
+export const getGetFieldsValuesQueryOptions = <
+ TData = Awaited<ReturnType<typeof getFieldsValues>>,
+ TError = RenderErrorResponseDTO
+>(
+ params?: GetFieldsValuesParams,
+ options?: {
+ query?: UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsValues>>,
+ TError,
+ TData
+ >;
+ },
+) => {
+ const { query: queryOptions } = options ?? {};
+
+ const queryKey = queryOptions?.queryKey ?? getGetFieldsValuesQueryKey(params);
+
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getFieldsValues>>> = ({
+ signal,
+ }) => getFieldsValues(params, signal);
+
+ return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsValues>>,
+ TError,
+ TData
+ > & { queryKey: QueryKey };
+};
+
+export type GetFieldsValuesQueryResult = NonNullable<
+ Awaited<ReturnType<typeof getFieldsValues>>
+>;
+export type GetFieldsValuesQueryError = RenderErrorResponseDTO;
+
+/**
+ * @summary Get field values
+ */
+
+export function useGetFieldsValues<
+ TData = Awaited<ReturnType<typeof getFieldsValues>>,
+ TError = RenderErrorResponseDTO
+>(
+ params?: GetFieldsValuesParams,
+ options?: {
+ query?: UseQueryOptions<
+ Awaited<ReturnType<typeof getFieldsValues>>,
+ TError,
+ TData
+ >;
+ },
+): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
+ const queryOptions = getGetFieldsValuesQueryOptions(params, options);
+
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
+ queryKey: QueryKey;
+ };
+
+ query.queryKey = queryOptions.queryKey;
+
+ return query;
+}
+
+/**
+ * @summary Get field values
+ */
+export const invalidateGetFieldsValues = async (
+ queryClient: QueryClient,
+ params?: GetFieldsValuesParams,
+ options?: InvalidateOptions,
+): Promise<QueryClient> => {
+ await queryClient.invalidateQueries(
+ { queryKey: getGetFieldsValuesQueryKey(params) },
+ options,
+ );
+
+ return queryClient;
+};
diff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.ts
index d5796b34f5..7aa36664eb 100644
--- a/frontend/src/api/generated/services/sigNoz.schemas.ts
+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts
@@ -1049,7 +1049,7 @@ export interface Querybuildertypesv5OrderByKeyDTO {
/**
* @type string
*/
- name?: string;
+ name: string;
/**
* @type string
*/
@@ -1141,6 +1141,79 @@ export interface RoletypesRoleDTO {
updatedAt?: Date;
}
+/**
+ * @nullable
+ */
+export type TelemetrytypesGettableFieldKeysDTOKeys = {
+ [key: string]: TelemetrytypesTelemetryFieldKeyDTO[];
+} | null;
+
+export interface TelemetrytypesGettableFieldKeysDTO {
+ /**
+ * @type boolean
+ */
+ complete: boolean;
+ /**
+ * @type object
+ * @nullable true
+ */
+ keys: TelemetrytypesGettableFieldKeysDTOKeys;
+}
+
+export interface TelemetrytypesGettableFieldValuesDTO {
+ /**
+ * @type boolean
+ */
+ complete: boolean;
+ values: TelemetrytypesTelemetryFieldValuesDTO;
+}
+
+export interface TelemetrytypesTelemetryFieldKeyDTO {
+ /**
+ * @type string
+ */
+ description?: string;
+ /**
+ * @type string
+ */
+ fieldContext?: string;
+ /**
+ * @type string
+ */
+ fieldDataType?: string;
+ /**
+ * @type string
+ */
+ name: string;
+ /**
+ * @type string
+ */
+ signal?: string;
+ /**
+ * @type string
+ */
+ unit?: string;
+}
+
+export interface TelemetrytypesTelemetryFieldValuesDTO {
+ /**
+ * @type array
+ */
+ boolValues?: boolean[];
+ /**
+ * @type array
+ */
+ numberValues?: number[];
+ /**
+ * @type array
+ */
+ relatedValues?: string[];
+ /**
+ * @type array
+ */
+ stringValues?: string[];
+}
+
export interface TypesChangePasswordRequestDTO {
/**
* @type string
@@ -1588,6 +1661,132 @@ export type DeleteAuthDomainPathParameters = {
export type UpdateAuthDomainPathParameters = {
id: string;
};
+export type GetFieldsKeysParams = {
+ /**
+ * @type string
+ * @description undefined
+ */
+ signal?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ source?: string;
+ /**
+ * @type integer
+ * @description undefined
+ */
+ limit?: number;
+ /**
+ * @type integer
+ * @format int64
+ * @description undefined
+ */
+ startUnixMilli?: number;
+ /**
+ * @type integer
+ * @format int64
+ * @description undefined
+ */
+ endUnixMilli?: number;
+ /**
+ * @type string
+ * @description undefined
+ */
+ fieldContext?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ fieldDataType?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ metricName?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ searchText?: string;
+};
+
+export type GetFieldsKeys200 = {
+ data?: TelemetrytypesGettableFieldKeysDTO;
+ /**
+ * @type string
+ */
+ status?: string;
+};
+
+export type GetFieldsValuesParams = {
+ /**
+ * @type string
+ * @description undefined
+ */
+ signal?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ source?: string;
+ /**
+ * @type integer
+ * @description undefined
+ */
+ limit?: number;
+ /**
+ * @type integer
+ * @format int64
+ * @description undefined
+ */
+ startUnixMilli?: number;
+ /**
+ * @type integer
+ * @format int64
+ * @description undefined
+ */
+ endUnixMilli?: number;
+ /**
+ * @type string
+ * @description undefined
+ */
+ fieldContext?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ fieldDataType?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ metricName?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ searchText?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ name?: string;
+ /**
+ * @type string
+ * @description undefined
+ */
+ existingQuery?: string;
+};
+
+export type GetFieldsValues200 = {
+ data?: TelemetrytypesGettableFieldValuesDTO;
+ /**
+ * @type string
+ */
+ status?: string;
+};
+
export type GetResetPasswordTokenPathParameters = {
id: string;
};
diff --git a/pkg/types/querybuildertypes/querybuildertypesv5/resp_test.go b/pkg/types/querybuildertypes/querybuildertypesv5/resp_test.go
index 3f5c517ad3..6861c613eb 100644
--- a/pkg/types/querybuildertypes/querybuildertypesv5/resp_test.go
+++ b/pkg/types/querybuildertypes/querybuildertypesv5/resp_test.go
@@ -130,7 +130,7 @@ func TestScalarData_MarshalJSON(t *testing.T) {
{4.0, 5.0, 6.0},
},
},
- expected: `{"queryName":"test_query","columns":[{"name":"value","signal":"","fieldContext":"","fieldDataType":"","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[1,2,3],[4,5,6]]}`,
+ expected: `{"queryName":"test_query","columns":[{"name":"value","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[1,2,3],[4,5,6]]}`,
},
{
name: "scalar data with NaN",
@@ -149,7 +149,7 @@ func TestScalarData_MarshalJSON(t *testing.T) {
{math.Inf(1), 5.0, math.Inf(-1)},
},
},
- expected: `{"queryName":"test_query","columns":[{"name":"value","signal":"","fieldContext":"","fieldDataType":"","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[1,"NaN",3],["Inf",5,"-Inf"]]}`,
+ expected: `{"queryName":"test_query","columns":[{"name":"value","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[1,"NaN",3],["Inf",5,"-Inf"]]}`,
},
{
name: "scalar data with mixed types",
@@ -168,7 +168,7 @@ func TestScalarData_MarshalJSON(t *testing.T) {
{nil, math.Inf(1), 3.14, false},
},
},
- expected: `{"queryName":"test_query","columns":[{"name":"mixed","signal":"","fieldContext":"","fieldDataType":"","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[["string",42,"NaN",true],[null,"Inf",3.14,false]]}`,
+ expected: `{"queryName":"test_query","columns":[{"name":"mixed","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[["string",42,"NaN",true],[null,"Inf",3.14,false]]}`,
},
{
name: "scalar data with nested structures",
@@ -189,7 +189,7 @@ func TestScalarData_MarshalJSON(t *testing.T) {
},
},
},
- expected: `{"queryName":"test_query","columns":[{"name":"nested","signal":"","fieldContext":"","fieldDataType":"","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[{"count":10,"value":"NaN"},[1,"Inf",3]]]}`,
+ expected: `{"queryName":"test_query","columns":[{"name":"nested","queryName":"test_query","aggregationIndex":0,"meta":{},"columnType":"aggregation"}],"data":[[{"count":10,"value":"NaN"},[1,"Inf",3]]]}`,
},
{
name: "empty scalar data",
diff --git a/pkg/types/telemetrytypes/field.go b/pkg/types/telemetrytypes/field.go
index f5a909b74a..db91a3e902 100644
--- a/pkg/types/telemetrytypes/field.go
+++ b/pkg/types/telemetrytypes/field.go
@@ -28,12 +28,12 @@ const (
)
type TelemetryFieldKey struct {
- Name string `json:"name"`
+ Name string `json:"name" required:"true"`
Description string `json:"description,omitempty"`
Unit string `json:"unit,omitempty"`
- Signal Signal `json:"signal,omitempty"`
- FieldContext FieldContext `json:"fieldContext,omitempty"`
- FieldDataType FieldDataType `json:"fieldDataType,omitempty"`
+ Signal Signal `json:"signal,omitzero"`
+ FieldContext FieldContext `json:"fieldContext,omitzero"`
+ FieldDataType FieldDataType `json:"fieldDataType,omitzero"`
JSONDataType *JSONDataType `json:"-"`
JSONPlan JSONAccessPlan `json:"-"`
@@ -268,8 +268,8 @@ type FieldValueSelector struct {
}
type GettableFieldKeys struct {
- Keys map[string][]*TelemetryFieldKey `json:"keys"`
- Complete bool `json:"complete"`
+ Keys map[string][]*TelemetryFieldKey `json:"keys" required:"true"`
+ Complete bool `json:"complete" required:"true"`
}
type PostableFieldKeysParams struct {
@@ -285,8 +285,8 @@ type PostableFieldKeysParams struct {
}
type GettableFieldValues struct {
- Values *TelemetryFieldValues `json:"values"`
- Complete bool `json:"complete"`
+ Values *TelemetryFieldValues `json:"values" required:"true"`
+ Complete bool `json:"complete" required:"true"`
}
type PostableFieldValueParams struct {
diff --git a/tests/integration/src/querier/01_logs.py b/tests/integration/src/querier/01_logs.py
index ab46c58901..4fc78866fa 100644
--- a/tests/integration/src/querier/01_logs.py
+++ b/tests/integration/src/querier/01_logs.py
@@ -1167,9 +1167,6 @@ def test_logs_time_series_count(
{
"key": {
"name": "host.name",
- "signal": "",
- "fieldContext": "",
- "fieldDataType": "",
},
"value": "linux-001",
}
@@ -1200,9 +1197,6 @@ def test_logs_time_series_count(
{
"key": {
"name": "host.name",
- "signal": "",
- "fieldContext": "",
- "fieldDataType": "",
},
"value": "linux-000",
}