Skip to content

toJsonSchema throws "Unexpected JSON Schema input for structure: {}" error when useRefs is true when structure is first child of intersection.Β #1612

@HamishWHC

Description

@HamishWHC

Report a bug

πŸ”Ž Search Terms

🧩 Context

  • ArkType version: 2.2.0
  • TypeScript version (5.1+): 6.0-beta
  • Other context you think may be relevant (JS flavor, OS, etc.): Bun + node

πŸ§‘β€πŸ’» Repro

Playground Link: https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%2520a%253A%2520%2522string%2522%2520%257D%29.or%28%2522null%2522%29%250A%250Aconsole.log%28Thing.toJsonSchema%28%257B%2520useRefs%253A%2520true%2520%257D%29%29%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2509a%253A%2520%2522string%2522%250A%257D%29%250A

const Thing = type({ a: "string" }).or("null")
console.log(Thing.toJsonSchema({ useRefs: true }))

Note: in my code, useRefs is being set to true due to cyclic types, but this is the minimal repro.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions