tiagobento commented on code in PR #2508:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2508#discussion_r1705469366


##########
packages/dmn-editor/src/mutations/addDecisionToDecisionService.ts:
##########
@@ -25,25 +25,42 @@ import { SnapGrid } from "../store/Store";
 import { MIN_NODE_SIZES } from "../diagram/nodes/DefaultSizes";
 import { NODE_TYPES } from "../diagram/nodes/NodeTypes";
 import { Normalized } from "../normalization/normalize";
+import {
+  DMN15__tBusinessKnowledgeModel,
+  DMN15__tDecision,
+  DMN15__tDecisionService,
+  DMN15__tInputData,
+  DMN15__tKnowledgeSource,
+} from "@kie-tools/dmn-marshaller/src/schemas/dmn-1_5/ts-gen/types";
+
+export type DrgElement =
+  | Normalized<{ __$$element: "decision" } & DMN15__tDecision>
+  | Normalized<{ __$$element: "businessKnowledgeModel" } & 
DMN15__tBusinessKnowledgeModel>
+  | Normalized<{ __$$element: "decisionService" } & DMN15__tDecisionService>
+  | Normalized<{ __$$element: "inputData" } & DMN15__tInputData>
+  | Normalized<{ __$$element: "knowledgeSource" } & DMN15__tKnowledgeSource>;
 
 export function addDecisionToDecisionService({
   definitions,
-  decisionId,
+  drgElement,
   decisionServiceId,
   drdIndex,
   snapGrid,
+  decisionShape,
+  elementId,
 }: {
   definitions: Normalized<DMN15__tDefinitions>;
-  decisionId: string;
+  drgElement: DrgElement;
   decisionServiceId: string;
   drdIndex: number;
   snapGrid: SnapGrid;
+  decisionShape: Normalized<DMNDI15__DMNShape>;
+  elementId: string;
 }) {

Review Comment:
   We only need the ID, but we need to know that this ID represents a Decision. 
The only way to know that is having the externalModelsByNamespace passed as 
parameter to the "addDecisionToDecisionService" mutation, so we can make that 
validation. You're mentioning the arguments you're passing when calling this 
mutation, but the mutation itself, after your changes, can be called with 
   
   ```typescript
   { 
     elementId: "bar"
     drgElement: { 
       "@_id": "foo" 
       ...
     }
   }
   ```
   
   which has the potential of being wrong. What I'm saying is that we rollback 
to the way it was before, and we include the `externalModelsByNamespace` 
parameters so we can look if that href (`nmspc#id`) represents a Decision on 
the model with namespace `nmspc`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to