xstate icon indicating copy to clipboard operation
xstate copied to clipboard

Bug: initialTransitionObject schema requires eventType but does not define it in properties

Open nirajkashyap1 opened this issue 3 months ago • 2 comments

XState version

XState version 5

Description

In the machine schema (packages/core/src/machine.schema.json), the definition for $defs.initialTransitionObject includes "eventType" as a required property (see "required": ["actions", "eventType", "source", "target"]), but "eventType" is not listed in the "properties" object. This means schemas that validate against this definition will fail, or the schema is invalid. This is likely an oversight and "eventType" should be added to the properties definition, or removed from the required list if not needed.

Expected result

The schema definition for initialTransitionObject should either include an eventType property (type: string) in properties, or remove eventType from the required array if it is not needed.

Actual result

eventType is currently required but not present in the properties for initialTransitionObject, leading to schema validation errors or confusion.

Reproduction

Open packages/core/src/machine.schema.json and inspect the $defs.initialTransitionObject section. Observe that eventType is in required but not in properties.

Additional context

This bug was identified by inspecting the schema file directly. No specific XState version context, but it is present in the current main branch.

nirajkashyap1 avatar Sep 09 '25 15:09 nirajkashyap1

assign this to me I will make it

manshusainishab avatar Oct 03 '25 18:10 manshusainishab

hey @davidkpiano , I have raised the PR with the changes may you please verify is it sufficient.

manshusainishab avatar Oct 05 '25 19:10 manshusainishab