In AI-assisted schema editing it is possible to select an element of the schema and only use the AI-assistance on this sub-schema to edit it. Then only the sub-schema is sent to LLM too. However, if the LLM comes up with new $defs, it will put it into this sub-schema too, not knowing there is more to the schema than this. For this case we need a utility, which detects whether the sub-schema got a $defs or definitions field generated and extracts it into the overall schema root, avoiding duplication and adjusting the name in case of duplication (e.g., by a numerical suffix which is counting up). After extraction of this definition, the new path of the definition must be known (if using the existing function to add new definitions, which already has duplication handling, it returns a Path element as return object). In the generated/edited sub-schema then all $ref to the old definitions path must be updated with the new one, based on where the definition was moved to.
In AI-assisted schema editing it is possible to select an element of the schema and only use the AI-assistance on this sub-schema to edit it. Then only the sub-schema is sent to LLM too. However, if the LLM comes up with new
$defs, it will put it into this sub-schema too, not knowing there is more to the schema than this. For this case we need a utility, which detects whether the sub-schema got a$defsordefinitionsfield generated and extracts it into the overall schema root, avoiding duplication and adjusting the name in case of duplication (e.g., by a numerical suffix which is counting up). After extraction of this definition, the new path of the definition must be known (if using the existing function to add new definitions, which already has duplication handling, it returns a Path element as return object). In the generated/edited sub-schema then all$refto the old definitions path must be updated with the new one, based on where the definition was moved to.