refactor(schema): simplify validation and OpenAPI generation (#2709)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-11 23:24:26 +02:00
1 parent 4bc5593f9f
commit de1fd95a99
510 files changed
+29494 -36131

No files matched your search

@@ -99,7 +99,7 @@ const RootComponent = React.forwardRef<HTMLDivElement, ModalProps>(
if (typeof ref === 'function') {
ref(node);
} else if (ref) {
(ref as React.MutableRefObject<HTMLDivElement | null>).current = node;
ref.current = node;
}
},
[ref],
@@ -129,7 +129,7 @@ export const SettingsModalDesktopScroll: React.FC<SettingsModalDesktopScrollProp
if (typeof scrollerRef === 'function') {
scrollerRef(node);
} else {
(scrollerRef as React.MutableRefObject<HTMLElement | null>).current = node;
scrollerRef.current = node;
}
});
return (
@@ -423,11 +423,11 @@ function resolvePinnedCallChannel(directMessagesDisabled: boolean): Channel | nu
interface DMChannelVisibilityControllerState {
readonly removalDelayMs: number;
readonly removalTimers: React.MutableRefObject<Map<string, number>>;
readonly removalTimers: React.RefObject<Map<string, number>>;
readonly orderedUnreadChannels: ReadonlyArray<Channel>;
readonly setVisibleChannels: React.Dispatch<React.SetStateAction<ReadonlyArray<Channel>>>;
readonly unreadChannels: ReadonlyArray<Channel>;
readonly unreadIdsRef: React.MutableRefObject<ReadonlySet<string>>;
readonly unreadIdsRef: React.RefObject<ReadonlySet<string>>;
}
interface ProjectVisibleDMChannelsRequest {
@@ -437,11 +437,11 @@ interface ProjectVisibleDMChannelsRequest {
class DMChannelVisibilityController {
private readonly removalDelayMs: number;
private readonly removalTimers: React.MutableRefObject<Map<string, number>>;
private readonly removalTimers: React.RefObject<Map<string, number>>;
private readonly orderedUnreadChannels: ReadonlyArray<Channel>;
private readonly setVisibleChannels: React.Dispatch<React.SetStateAction<ReadonlyArray<Channel>>>;
private readonly unreadChannels: ReadonlyArray<Channel>;
private readonly unreadIdsRef: React.MutableRefObject<ReadonlySet<string>>;
private readonly unreadIdsRef: React.RefObject<ReadonlySet<string>>;
public constructor({
removalDelayMs,
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {assign, getInitialSnapshot, type SnapshotFrom, setup, transition} from 'xstate';
import {assign, initialTransition, type SnapshotFrom, setup, transition} from 'xstate';
export type ScrollIndicatorSeverity = 'mention' | 'unread';
export type ScrollIndicatorDirection = 'top' | 'bottom';
@@ -238,7 +238,7 @@ export type ScrollIndicatorMachineSnapshot = SnapshotFrom<typeof scrollIndicator
export type ScrollIndicatorStateValue = 'hidden' | 'visible';
export function createScrollIndicatorSnapshot(input: ScrollIndicatorMachineInput = {}): ScrollIndicatorMachineSnapshot {
return getInitialSnapshot(scrollIndicatorStateMachine, input);
return initialTransition(scrollIndicatorStateMachine, input)[0];
}
export function transitionScrollIndicatorSnapshot(
@@ -3,7 +3,7 @@
import {type DragItem, DragItemType, type DropResult} from '@app/features/app/components/layout/types/DndTypes';
import {getVerticalDropTargetHeight, resolveVerticalDropEdge} from '@app/features/ui/dnd/DropGeometry';
import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';
import {assign, getInitialSnapshot, type SnapshotFrom, setup, transition} from 'xstate';
import {assign, initialTransition, type SnapshotFrom, setup, transition} from 'xstate';
export interface ChannelReorderPoint {
x: number;
@@ -244,7 +244,7 @@ export type ChannelReorderSnapshot = SnapshotFrom<typeof channelReorderStateMach
export type ChannelReorderStateValue = 'idle' | 'resolving' | 'targeting' | 'voiceParticipantTransfer' | 'blocked';
export function createChannelReorderSnapshot(): ChannelReorderSnapshot {
return getInitialSnapshot(channelReorderStateMachine);
return initialTransition(channelReorderStateMachine)[0];
}
export function transitionChannelReorderSnapshot(
@@ -18,7 +18,7 @@ import {
import {RelativePosition} from '@app/features/ui/RelativePosition';
import {
assign,
getInitialSnapshot,
initialTransition,
type MachineSnapshot,
type MetaObject,
type NonReducibleUnknown,
@@ -380,7 +380,7 @@ export type GuildReorderSnapshot = MachineSnapshot<
>;
export function createGuildReorderSnapshot(): GuildReorderSnapshot {
return getInitialSnapshot(guildReorderStateMachine);
return initialTransition(guildReorderStateMachine)[0];
}
export function transitionGuildReorderSnapshot({
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {MessageNotifications} from '@fluxer/constants/src/NotificationConstants';
import {assign, getInitialSnapshot, type SnapshotFrom, setup, transition} from 'xstate';
import {assign, initialTransition, type SnapshotFrom, setup, transition} from 'xstate';
import type {ChannelUnreadState, ChannelUnreadStateInput} from './ChannelUnreadState';
interface ChannelUnreadMachineContext extends ChannelUnreadStateInput {}
@@ -74,7 +74,7 @@ export const channelUnreadStateMachine = setup({
export type ChannelUnreadSnapshot = SnapshotFrom<typeof channelUnreadStateMachine>;
export function createChannelUnreadSnapshot(input: ChannelUnreadStateInput): ChannelUnreadSnapshot {
return getInitialSnapshot(channelUnreadStateMachine, input);
return initialTransition(channelUnreadStateMachine, input)[0];
}
export function transitionChannelUnreadSnapshot(
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {assign, getInitialSnapshot, type SnapshotFrom, setup, transition} from 'xstate';
import {assign, initialTransition, type SnapshotFrom, setup, transition} from 'xstate';
export type WizardStep =
| 'welcome'
@@ -157,7 +157,7 @@ export const setupWizardStateMachine = setup({
export type SetupWizardSnapshot = SnapshotFrom<typeof setupWizardStateMachine>;
export function createSetupWizardSnapshot(): SetupWizardSnapshot {
return getInitialSnapshot(setupWizardStateMachine);
return initialTransition(setupWizardStateMachine)[0];
}
export function transitionSetupWizardSnapshot(
@@ -127,8 +127,7 @@ export const FriendSelector: React.FC<FriendSelectorProps> = observer(
const isMaxed = maxSelections !== undefined && selectedUserIds.length >= maxSelections;
const isMutableRefObject = (
ref: React.Ref<HTMLInputElement> | undefined,
): ref is React.MutableRefObject<HTMLInputElement | null> =>
typeof ref === 'object' && ref !== null && 'current' in ref;
): ref is React.RefObject<HTMLInputElement | null> => typeof ref === 'object' && ref !== null && 'current' in ref;
const renderSearchInput = ({inputProps, inputClassName, ref: forwardedRef}: RenderInputArgs) => {
const handleRef = (node: HTMLInputElement | null) => {
inputRef.current = node;