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

Unable to load RELATIVE $ref property #913

Closed
eugeniace opened this issue Nov 6, 2018 · 3 comments
Closed

Unable to load RELATIVE $ref property #913

eugeniace opened this issue Nov 6, 2018 · 3 comments

Comments

@eugeniace
Copy link

eugeniace commented Nov 6, 2018

We defined a swagger file ( src/main/resources/BS/ApiSpecification.swagger ) that references a property defined in a JSON file (src/main/resources/BO/Resource/ApiSpecificationBO.json).
In ApiSpecificationBO.json file there is a relative $ref property defined in another JSON (src/main/resources/BO/Common/BasicComponents.json).

The class generating fails with the fallowing error from swagger-parser:
Unable to load RELATIVE ref: ../Common/BasicComponents.json path: C:\utils-app\src\main\resources\BS

As we can see, it tries to resolve the reference to the second JSON file considering as a parent folder the one where the initial swagger file is placed, and not the folder where the JSON file containing the $ref is placed.

We used version v1.0.39.

Resources:


src/main/resources/BS/ApiSpecification.swagger:

[...]
"responses": {
                    "200": {
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/accessProfileBO"
                            }
                        }
                    }
                }
[...]
"definitions": {
        "accessProfileBO": {
            "$ref": "../BO/Resource/ApiSpecificationBO.json"
        }
    },
[...]

src/main/resources/BO/Resource/ApiSpecificationBO.json

{
    "properties": {
        "details": {
            "type": "object",
            "properties": {
                "confirmationCodeRequired": {
                    "$ref": "../Common/BasicComponents.json#/properties/indicatorType"
                }
            }
        }
    }
}

src/main/resources/BO/Common/BasicComponents.json

{
    "properties": {
        "indicatorType": {
            "type": "object",
            "properties": {
                "indicator": {
                    "type": "boolean"
                }
            }
        }
    }
}

src.zip

@eugeniace
Copy link
Author

I have fixed the issue and created a pull request. Please approve:

#915

@eugeniace
Copy link
Author

Please approve the fix for this issue:
#917

gracekarina added a commit that referenced this issue Nov 8, 2018
Fix for #913 - problem with properties in object #ref
@gracekarina
Copy link
Contributor

Fixed by #917 please let us know if this keeps happening. Thanks!

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