Skip to content

Commit

Permalink
[backend] code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
labo-flg committed Jan 2, 2024
1 parent 0b11112 commit 219b5c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions opencti-platform/opencti-graphql/src/schema/schema-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export const validateAndFormatSchemaAttribute = (
}
}
if (isObjectAttribute(attributeName)) {
// current limitation: field patch is only possible with arrays
if (editInput.object_path && !attributeDefinition.multiple) {
throw ValidationError(attributeName, { message: `Attribute ${attributeName} is not multiple, object_path cannot be used`, data: editInput });
}

let validationValues = editInput.value;
if (editInput.object_path) {
// current limitation: field patch is only possible with arrays
if (!attributeDefinition.multiple) {
throw ValidationError(attributeName, { message: `Attribute ${attributeName} is not multiple, object_path cannot be used`, data: editInput });
}

// If object path is setup, controlling the field is much harder.
// Concept here is to apply the partial operation and check if the result comply to the schema
const pointers = JSONPath({ json: initial, resultType: 'pointer', path: `${editInput.key}${editInput.object_path}` });
Expand Down

0 comments on commit 219b5c3

Please sign in to comment.