-
Notifications
You must be signed in to change notification settings - Fork 109
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
Resource idName #38
Comments
Hi! The Eloquent adapter is used by the store to checked that the combination of the The So if the Hope that helps. |
Yes, it helps, but I still don't get it: To validate inbound requests for a PATCH, you check that the resource type and id in the url The only reason I can think of is to check for existence of the resource in the database (PATCH), or for unicity (POST), via a validator, thus the column name could be Why should we declare this column name twice? First in the Schema for creating the Json (outbound), and then via the config file for validating the resource to patch (inbound)? I can't think of a single scenario where those would be two different values? At least default value for the Schema should be the one in the config file (if declared). |
For the URL id value, the store needs to check that a person object with that id exists, otherwise it needs to send a For example on content validation, if receiving this inbound {
"data": {
"type": "comments",
"attributes": {
"content": "My comment..."
},
"relationships": {
"posts": {
"data": {
"type": "posts",
"id": "99"
}
}
}
}
} The validators need to check the In terms of having to define it twice. That's because at the moment there's no central definition of how an Eloquent model maps to its JSON API representation. That's definitely the kind of direction that this package could go in. However, at the moment the schema and the store are separate things because the scheme comes from the underlying library that this package is built on - the As this package develops hopefully we can combine the Eloquent integration down into a single place rather than the separate places as exists at the moment. Any ideas and suggestions are welcome! |
Yes your example illustrates my second paragraph, I get it. And I understand the need for separation. I will gladly participate and make suggestions, once I am more familiar with the package. Here's one: make default values configurable, such as I may have more questions, is there a Gitter chat for the package to address questions from the community? Needless to say, I plan on using this a lot and you did a marvelous job, thanx! |
@JeanLucEsser no gitter channel at the moment I'm afraid. For the mo, just open issues to ask questions. |
This is more of a clarification than an issue but still.
In the json-api config file, you can specify the column to use for the resource id. Or so I thought. I tried adding something like
People\Schema::RESOURCE_TYPE => 'mynewid'
with no luck.The only way I could change the id used in the returned Json was by overriding the
idName
property in the resource Schema:protected $idName = 'mynewid';
This may be a newbie question, but did I misunderstood the use of the
eloquent-adapter
's columns array in the config file?The text was updated successfully, but these errors were encountered: