diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json index b1765eb5896ea..050e3dafb2454 100644 --- a/frontend/src/queries/schema.json +++ b/frontend/src/queries/schema.json @@ -410,7 +410,14 @@ "$ref": "#/definitions/BreakdownKeyType" }, "breakdown_group_type_index": { - "type": "integer" + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] }, "breakdown_hide_other_aggregation": { "type": ["boolean", "null"] diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema.ts index e47311d8e8a16..d647f789a90dc 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema.ts @@ -26,6 +26,10 @@ import { TrendsFilterType, } from '~/types' +// Type alias for number to be reflected as integer in json-schema. +/** @asType integer */ +type integer = number + /** * PostHog Query Schema definition. * @@ -196,10 +200,8 @@ export interface HogQLQueryResponse { /** Modifiers used when performing the query */ modifiers?: HogQLQueryModifiers hasMore?: boolean - /** @asType integer */ - limit?: number - /** @asType integer */ - offset?: number + limit?: integer + offset?: integer } /** Filters object that will be converted to a HogQL {filters} placeholder */ @@ -221,10 +223,8 @@ export interface HogQLQuery extends DataNode { } export interface HogQLNotice { - /** @asType integer */ - start?: number - /** @asType integer */ - end?: number + start?: integer + end?: integer message: string fix?: string } @@ -328,14 +328,12 @@ export interface HogQLAutocomplete extends DataNode { filters?: HogQLFilters /** * Start position of the editor word - * @asType integer */ - startPosition: number + startPosition: integer /** * End position of the editor word - * @asType integer */ - endPosition: number + endPosition: integer response?: HogQLAutocompleteResponse } @@ -356,8 +354,7 @@ export interface EventsNode extends EntityNode { kind: NodeKind.EventsNode /** The event or `null` for all events. */ event?: string | null - /** @asType integer */ - limit?: number + limit?: integer /** Columns to order by */ orderBy?: string[] /** Return a limited set of data */ @@ -369,8 +366,7 @@ export interface EventsNode extends EntityNode { export interface ActionsNode extends EntityNode { kind: NodeKind.ActionsNode - /** @asType integer */ - id: number + id: integer } export type AnyEntityNode = EventsNode | ActionsNode @@ -388,10 +384,8 @@ export interface EventsQueryResponse { hogql: string hasMore?: boolean timings?: QueryTiming[] - /** @asType integer */ - limit?: number - /** @asType integer */ - offset?: number + limit?: integer + offset?: integer } export interface EventsQueryPersonColumn { uuid: string @@ -418,19 +412,16 @@ export interface EventsQuery extends DataNode { event?: string | null /** * Number of rows to return - * @asType integer */ - limit?: number + limit?: integer /** * Number of rows to skip before returning rows - * @asType integer */ - offset?: number + offset?: integer /** * Show events matching a given action - * @asType integer */ - actionId?: number + actionId?: integer /** Show events for a given person */ personId?: string /** Only fetch events that happened before this timestamp */ @@ -446,17 +437,14 @@ export interface EventsQuery extends DataNode { export interface PersonsNode extends DataNode { kind: NodeKind.PersonsNode search?: string - /** @asType integer */ - cohort?: number + cohort?: integer distinctId?: string /** Properties configurable in the interface */ properties?: AnyPropertyFilter[] /** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */ fixedProperties?: AnyPropertyFilter[] - /** @asType integer */ - limit?: number - /** @asType integer */ - offset?: number + limit?: integer + offset?: integer } // Data table node @@ -606,9 +594,8 @@ export interface InsightsQueryBase extends Node { properties?: AnyPropertyFilter[] | PropertyGroupFilter /** * Groups aggregation - * @asType integer **/ - aggregation_group_type_index?: number + aggregation_group_type_index?: integer /** Sampling rate */ samplingFactor?: number | null } @@ -670,10 +657,8 @@ export type FunnelsFilterLegacy = Omit< > export interface FunnelExclusionSteps { - /** @asType integer */ - funnelFromStep: number - /** @asType integer */ - funnelToStep: number + funnelFromStep: integer + funnelToStep: integer } export interface FunnelExclusionEventsNode extends EventsNode, FunnelExclusionSteps {} export interface FunnelExclusionActionsNode extends ActionsNode, FunnelExclusionSteps {} @@ -685,17 +670,13 @@ export type FunnelsFilter = { /** @asType integer */ binCount?: FunnelsFilterLegacy['bin_count'] breakdownAttributionType?: FunnelsFilterLegacy['breakdown_attribution_type'] - /** @asType integer */ - breakdownAttributionValue?: FunnelsFilterLegacy['breakdown_attribution_value'] + breakdownAttributionValue?: integer funnelAggregateByHogQL?: FunnelsFilterLegacy['funnel_aggregate_by_hogql'] - /** @asType integer */ - funnelToStep?: FunnelsFilterLegacy['funnel_to_step'] - /** @asType integer */ - funnelFromStep?: FunnelsFilterLegacy['funnel_from_step'] + funnelToStep?: integer + funnelFromStep?: integer funnelOrderType?: FunnelsFilterLegacy['funnel_order_type'] funnelVizType?: FunnelsFilterLegacy['funnel_viz_type'] - /** @asType integer */ - funnelWindowInterval?: FunnelsFilterLegacy['funnel_window_interval'] + funnelWindowInterval?: integer funnelWindowIntervalUnit?: FunnelsFilterLegacy['funnel_window_interval_unit'] hidden_legend_breakdowns?: FunnelsFilterLegacy['hidden_legend_breakdowns'] funnelStepReference?: FunnelsFilterLegacy['funnel_step_reference'] @@ -740,8 +721,7 @@ export type RetentionFilter = { } export interface RetentionValue { - /** @asType integer */ - count: number + count: integer } export interface RetentionResult { @@ -883,8 +863,7 @@ export type QueryStatus = { id: string /** @default true */ query_async: boolean - /** @asType integer */ - team_id: number + team_id: integer /** @default false */ error: boolean /** @default false */ @@ -923,12 +902,9 @@ export interface ActorsQueryResponse { hogql: string timings?: QueryTiming[] hasMore?: boolean - /** @asType integer */ - limit: number - /** @asType integer */ - offset: number - /** @asType integer */ - missing_actors_count?: number + limit: integer + offset: integer + missing_actors_count?: integer } export interface ActorsQuery extends DataNode { @@ -939,10 +915,8 @@ export interface ActorsQuery extends DataNode { properties?: AnyPropertyFilter[] fixedProperties?: AnyPropertyFilter[] orderBy?: string[] - /** @asType integer */ - limit?: number - /** @asType integer */ - offset?: number + limit?: integer + offset?: integer response?: ActorsQueryResponse } @@ -1044,8 +1018,7 @@ export interface WebStatsTableQuery extends WebAnalyticsQueryBase { includeScrollDepth?: boolean // automatically sets includeBounceRate to true includeBounceRate?: boolean doPathCleaning?: boolean - /** @asType integer */ - limit?: number + limit?: integer } export interface WebStatsTableQueryResponse extends QueryResponse { results: unknown[] @@ -1054,10 +1027,8 @@ export interface WebStatsTableQueryResponse extends QueryResponse { hogql?: string samplingRate?: SamplingRate hasMore?: boolean - /** @asType integer */ - limit?: number - /** @asType integer */ - offset?: number + limit?: integer + offset?: integer } export type InsightQueryNode = @@ -1088,8 +1059,7 @@ export type InsightFilter = | StickinessFilter | LifecycleFilter -/** @asType integer */ -export type Day = number +export type Day = integer export interface InsightActorsQuery { kind: NodeKind.InsightActorsQuery @@ -1098,19 +1068,16 @@ export interface InsightActorsQuery