Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
farazoman opened this issue Apr 12, 2021 · 1 comment
Milestone

Comments

@farazoman
Copy link

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

@farazoman farazoman 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 Apr 12, 2021
@joelittlejohn joelittlejohn added this to the 1.1.1 milestone Apr 12, 2021
@joelittlejohn
Copy link
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.

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

No branches or pull requests

2 participants