dependabot[bot] on npm_and_yarn
Bump json5 from 1.0.1 to 1.0.2 … (compare)
dependabot[bot] on npm_and_yarn
Bump qs and body-parser Bumps … (compare)
dependabot[bot] on npm_and_yarn
Bump decode-uri-component from … (compare)
dependabot[bot] on npm_and_yarn
Bump engine.io and karma Bumps… (compare)
dependabot[bot] on npm_and_yarn
Bump loader-utils from 1.2.3 to… (compare)
dependabot[bot] on npm_and_yarn
I'm using vue, I write this code on the app.vue and I'm using the hot reload, any time that some change is detected the app is reloaded..
CarbonService.createDocument: function(carbon, rootPath, document, slug ){
return carbon.documents.createChild( "/"+rootPath, document, slug );
}
let carbon = CarbonService.init();
let something = {};
let slug = "users";
CarbonService.createDocument(carbon, "/", something, slug).then(
( [ persistedProject, response ] ) => {
console.log( something === persistedProject ); // true
console.log( something.id ); // document's URI
}
).catch( console.error );
I run the script to create a document and I wait to see on the browser console the log of true and document URI, after that I'm going to my code again and change the slug variable to this:
CarbonService.createDocument: function(carbon, rootPath, document, slug ){
return carbon.documents.createChild( "/"+rootPath, document, slug );
}
let carbon = CarbonService.init();
let something = {};
let slug = "roles";
CarbonService.createDocument(carbon, "/", something, slug).then(
( [ persistedProject, response ] ) => {
console.log( something === persistedProject ); // true
console.log( something.id ); // document's URI
}
).catch( console.error );
the app is reloaded and run the script again, and is there where I see the 409 error on the browser console.
//
"/"+rootPath
docker stop <container-name>
<carbon-directory>/data/zookeeper
docker start <container-name
carbonSchemas.PROJECT = {
"forecastID": {
"@id": "tms:forecastID",
"@type": "string"
},
"name": {
"@id": "https://schema.org/name",
"@type": "string"
},
"updatedDate": {
"@id": "tms:updatedDate",
"@type": "dateTime"
}
}
carbon.extendObjectSchema(`${CONTEXT_URL}#ForecastProject`, carbonSchemas.PROJECT);
let project = {
"forecastID": "XXXXX",
"color": "orange",
"name": "someName",
"updatedDate": "2018-01-17T04:14:54.150Z",
"types": ["http://tms.base22.com/ns#ForecastProject"]
}
carbon.documents.createChild("/projects/", project )...
Hello, I'm trying to add a type to a document but I'm receiving a 400 error code, Error: The attempt of parsing the request's body failed
this is the request response:
[{"@id":"_:node1c40v47nrx16996","@type":["https://carbonldp.com/ns/v1/platform#ErrorResponse"],"https://carbonldp.com/ns/v1/platform#error":[{"@id":"_:node1c40v47nrx16997"}],"https://carbonldp.com/ns/v1/platform#httpStatusCode":[{"@type":"http://www.w3.org/2001/XMLSchema#int","@value":"400"}],"https://carbonldp.com/ns/v1/platform#requestID":[{"@value":"32b1cdcc-5d3b-4901-9da2-e08b9eb58a60"}]},{"@id":"_:node1c40v47nrx16997","@type":["https://carbonldp.com/ns/v1/platform#Error"],"https://carbonldp.com/ns/v1/platform#errorCode":[{"@value":"0x6970"}],"https://carbonldp.com/ns/v1/platform#errorMessage":[{"@language":"es","@value":"The attempt of parsing the request's body failed"}],"https://carbonldp.com/ns/v1/platform#errorParameters":[{"@id":"_:node1c40v47nrx16998"}]},{"@id":"_:node1c40v47nrx16998","@type":["https://carbonldp.com/ns/v1/platform#Map"],"https://carbonldp.com/ns/v1/platform#entry":[{"@id":"_:node1c40v47nrx16999"},{"@id":"_:node1c40v47nrx17000"},{"@id":"_:node1c40v47nrx17001"}]},{"@id":"_:node1c40v47nrx16999","https://carbonldp.com/ns/v1/platform#key":[{"@value":"column"}],"https://carbonldp.com/ns/v1/platform#value":[{"@type":"http://www.w3.org/2001/XMLSchema#int","@value":"57"}]},{"@id":"_:node1c40v47nrx17000","https://carbonldp.com/ns/v1/platform#key":[{"@value":"parserErrorMessage"}],"https://carbonldp.com/ns/v1/platform#value":[{"@value":"Encountered \" <IRI> \"<http://tms.base22.com/ns#ForecastPerson> \"\" at line 1, column 57.\nWas expecting:\n \":\" ...\n "}]},{"@id":"_:node1c40v47nrx17001","https://carbonldp.com/ns/v1/platform#key":[{"@value":"line"}],"https://carbonldp.com/ns/v1/platform#value":[{"@type":"http://www.w3.org/2001/XMLSchema#int","@value":"1"}]}]
and this is my code:
carbon.documents.get("users/").then(( [ user, response ] ) => {
user.addType("http://tms.base22.com/ns#ForecastPerson");
return user.save();
}).then(
( [ user, response ] ) => {
console.log(user);
}
).catch( console.error );
and my request payload is:Add { <http://carbonldp.webtraining.zone:8083/users/> a <http://tms.base22.com/ns#ForecastPerson>. }.
I saw that the error is because the parser encountered <IRI>, my question is: can't I add a custom type? or which is the format for add a type with the function addType?