Skip to content

nested sibling references causes error Path not present: definitions only on https://www.jsonschema2pojo.org/, local is fine #1237

Closed

Description

@farazoman

I have a json schema that has nested references in the "definitions" property. What I mean is that I have one property defined say "PropertyA" then a second property is defined called "PropertyB" which references "PropertyA"

When I use the preview button on https://www.jsonschema2pojo.org/ then I get the error Path not present: definitions.

I narrowed down the problem to the nested references, i.e "#/definitions/PropertyA" . When running jsonschema2pojo on my local it works fine.

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Inbox Item Datalake DTO",
    "definitions": {
        "PropertyA": {
            "type": "object",
            "properties": {
                "value": {
                    "type": "string"
                }
            }
        },
        "PropertyB": {
            "type": "object",
            "properties": {
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/PropertyA"
                    },
                    "default": []
                }
            }
        }
    },
    "properties": {
        "FinalProperty": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/PropertyB"
            },
            "default": []
        }
    }
}

I saw a few posts online about using an absolute path but this is in the exact same file so nothing I could do there. Also I opened a stackoverflow question. https://stackoverflow.com/posts/67050796/edit

Activity

  1. changed the title [-]nested sibling references causes error `Path not present: definitions`[/-] [+]nested sibling references causes error `Path not present: definitions` only on https://www.jsonschema2pojo.org/, local is fine[/+] on Apr 12, 2021
  2. added this to the 1.1.1 milestone on Apr 12, 2021
  3. joelittlejohn commented on Apr 12, 2021

    @joelittlejohn
    Owner

    Thanks for reporting this. This is very similar to #793 but from the website we use a way of providing the schema as a string and refs are resolved a little differently.

    We will have to release 1.1.1 and update the website to use it, but this should be fixed on the website soon.

  4. added a commit that references this issue on Aug 8, 2024
    a10a93a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions