We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I created the following model:
jsonApiInstance.define('screen', { name: '' }
When I send patch request, I get the following error:
patch
:5000/screens/3:1 PATCH http://localhost:5000/screens/3 409 (CONFLICT) minilog.js?2831:17 devour Error: Request failed with status code 409 at createError (createError.js?16d0:16) at settle (settle.js?db52:18) at XMLHttpRequest.handleLoad (xhr.js?ec6c:77) actions.js?e1db:23 {type: {…}} type : {title: "Incorrect type", detail: "Invalid type. Expected "screen"."} __proto__ : Object
This can be resolved by explicitly specifying type in define's options argument:
type
define
options
jsonApiInstance.define('screen', { name: '' }, { type: 'screen' })
The cause for this issue is in devour/src/middleware/json-api/_serialize.js file:
devour/src/middleware/json-api/_serialize.js
function resource (modelName, item) { // ... let typeName = options.type || this.pluralize(modelName) // ... }
I think it is more correct to use this.pluralize.singular for this case.
this.pluralize.singular
The text was updated successfully, but these errors were encountered:
I am seeing the same issue. Is pluralizing the resource part of the jsonapi spec?
Sorry, something went wrong.
I was able to take care of this by setting up the devour object with the pluralize option set to false
const jsonApi = new JsonApi({apiUrl:'https://site/jsonapi', pluralize: false});
No branches or pull requests
I created the following model:
When I send
patch
request, I get the following error:This can be resolved by explicitly specifying
type
indefine
'soptions
argument:The cause for this issue is in
devour/src/middleware/json-api/_serialize.js
file:I think it is more correct to use
this.pluralize.singular
for this case.The text was updated successfully, but these errors were encountered: