Skip to content

Error: Include paths should contain only allowed ones. #64

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

Closed
gigo6000 opened this issue Jun 5, 2017 · 3 comments
Closed

Error: Include paths should contain only allowed ones. #64

gigo6000 opened this issue Jun 5, 2017 · 3 comments

Comments

@gigo6000
Copy link

gigo6000 commented Jun 5, 2017

Hi, I'm playing with the demo and can't figure out why I can't use the "include" query string, for example if I call this:

/api/v1/posts/1?include=comments

I get:

{
    "errors": [
        {
            "title": "Include paths should contain only allowed ones.",
            "source": {
                "parameter": "include"
            }
        }
    ]
}

I can't find where to define the mentioned allowed include paths. Is this a bug? or lack of documentation, Thanks.

@gigo6000
Copy link
Author

gigo6000 commented Jun 5, 2017

Ok, I found how :). Adding this to app/JsonApi/Posts/Validators.php:

   protected $allowedIncludePaths = [
        'comments',
        'author'
    ]; 

I'll be happy to add this to the documentation.

@lindyhopchris
Copy link
Member

Glad you figured it out and sorry the docs haven't been written yet. As the package is starting to stabilise I'm looking at getting some extra chapters added relatively soon.

@lindyhopchris
Copy link
Member

Closing this as include paths (and validating/allowing them) is now fully documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants