Skip to content

Add support anyOf, oneOf, and allOf#38

Merged
lovasoa merged 2 commits into
lovasoa:mainfrom
sozdayka:main
Apr 20, 2026
Merged

Add support anyOf, oneOf, and allOf#38
lovasoa merged 2 commits into
lovasoa:mainfrom
sozdayka:main

Conversation

@sozdayka
Copy link
Copy Markdown
Contributor

Summary

  • Fix TypeScript error in ArrayEditor when selecting combinator types (anyOf, oneOf, allOf) for array item schemas
  • Update README to reflect recently added features

Changes

Bug fix: combinator type support in ArrayEditor

The TypeDropdown in the array item editor was passing SchemaEditorType (which includes "anyOf", "oneOf", "allOf") directly as the type field of a JSON Schema object. This caused a TypeScript error because type only accepts primitive JSON Schema types.

The onChange handler now mirrors the logic already used in SchemaPropertyEditor: when a combinator type is selected, it builds the appropriate anyOf/oneOf/allOf structure instead of setting type directly.

Before:

onChange={(newType) => {
  handleItemSchemaChange({
    ...withObjectSchema(itemsSchema, (s) => s, {}),
    type: newType, // TS error: "allOf" is not assignable to SchemaType
  });
}}

After:

onChange={(newType: SchemaEditorType) => {
  if (newType === "anyOf" || newType === "oneOf" || newType === "allOf") {
    const { type: _type, anyOf: _a, oneOf: _o, allOf: _al, ...rest } = asObjectSchema(itemsSchema);
    const initial = newType === "allOf"
      ? { allOf: [{ type: "object" as const }] }
      : { [newType]: [{ type: "string" as const }, { type: "number" as const }] };
    handleItemSchemaChange({ ...rest, ...initial });
  } else {
    const { anyOf: _a, oneOf: _o, allOf: _al, ...rest } = asObjectSchema(itemsSchema);
    handleItemSchemaChange({ ...rest, type: newType });
  }
}}

README updates

  • Added anyOf/oneOf/allOf combinator support and additionalProperties to the Features section
  • Added a "Combinator Schemas" subsection under Project Architecture

@lovasoa lovasoa merged commit a043e8a into lovasoa:main Apr 20, 2026
3 checks passed
@lovasoa
Copy link
Copy Markdown
Owner

lovasoa commented Apr 20, 2026

thanks !

@lovasoa
Copy link
Copy Markdown
Owner

lovasoa commented Apr 20, 2026

Looks like you committed a claude worktree !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants