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

Custom controller actions and attributes structure #231

Open
invaders-xx opened this issue Mar 30, 2023 · 3 comments
Open

Custom controller actions and attributes structure #231

invaders-xx opened this issue Mar 30, 2023 · 3 comments

Comments

@invaders-xx
Copy link

invaders-xx commented Mar 30, 2023

I have a Schema and a Controller which implements the standards. I want to add several actions to that controllers. Each post action accepts a different data structure. How can I handle that as the data structure is related to Schema fields definition. Or maybe I missed smth.
I am using cloudcreativity/laravel-json-api in previous projects . But as mentioned, for new projects, this package should be used but I feel confused/lost with this new package

@lindyhopchris
Copy link
Contributor

By "actions", do you mean custom actions? If you're using different data structures, for custom actions, there's not much I can do to support it - as the point of the package is to handle the JSON:API spec. Which means it can't handle custom things that deviate from the spec.

Unless I'm missing something about your question? You might need to provide an actual example - if you're doing something that is covered by the spec but you can't find a way to make it work?

@invaders-xx
Copy link
Author

invaders-xx commented Mar 30, 2023

I just need to to have a custom action within a controller using a custom request with rules. In previous version I was using Validators. But now, if I define rules for this specific action I need to define the fields within the schema, which could be different with the standard schema of the resource associated with this schema

@lindyhopchris
Copy link
Contributor

Yeah I'm a bit lost, sorry. The schema is meant to define the resource representation in the JSON:API compliant server. I'm not sure why the schema would be changing? E.g. if you have a posts resource, then the schema should represent that resource... the resource shouldn't change structure in different scenarios as that would be unpredictable to the client.

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