Skip to content

Support self-referential structures #46

@BrodyEller

Description

@BrodyEller

Describe the bug
When attempting to generate a jsonschema using a struct that references itself(jsonschema.Schema for example), an error is returned: cycle detected for type jsonschema.Schema. This error is coming from jsonschema/infer.go

To Reproduce
Steps to reproduce the behavior:

  1. Generate a jsonschema using jsonschema.Schema or any other struct that references itself.

Expected behavior
Generate a ref instead of erroring

Logs
cycle detected for type jsonschema.Schema

Additional context
For reference, my use case is accepting a json schema as input to an MCP tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions