Custom namespace in bpmn xml

I have created a custom namespace, in which I am extending the service task and added new attributes

here is the json

{
  "name": "myService",
  "uri": "http://some-company/schema/bpmn/serviceImpl",
  "$schema": "http://json-schema.org/draft-07/schema",
  "description": "It is a service method to be implemented",
  "prefix": "serviceImpl",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "types": [
    {
      "name": "implementationTask",
      "extends": [
        "bpmn:ServiceTask"
      ],
      "properties": [
        {
          "name": "isMyService",
          "description": "This variable tells what type of task it is",
          "isAttr": true,
          "type": "Boolean"
        },
        {
          "name": "result",
          "description": "varibale that holds the return value of service method",
          "isAttr": true,
          "type": "String"
        }
      ]
    }
  ],
  "emumerations": [],
  "associations": []
}

is this the right way?

now i want to add support for api calls as well, for that matter i have this type of data that i need to support in bpmn xml

{
	"serviceName": "hello-world",
    "details": {
        "apiUri": "",
        "payload": {
		  
		},
		"successResponse": {
		  "user": {
		  }
		},
		"prop1": [
		  
		],
		"prop2": [
		  {
			"type": "type1",
			"value": [
			  {
				"info": "infoValue"
			  }
			]
		  }
		]
	  }
	}

what is the best way adding attributes or child elements? If anybody can suggest what is the better way to support this type of data

Using extends is the right way, and also what Camunda does with their moddle extensions.

The way to store custom elements is in the bpmn:extensionElements section. It could look like the following:

    <bpmn:serviceTask id="Activity_1dzklbh">
      <bpmn:extensionElements>
        <serviceImpl:service name="hello-world">
          <serviceImpl:details />
        </serviceImpl:myService>
      </bpmn:extensionElements>
      ...
    </bpmn:serviceTask>

Note how we define a custom extension element to host more complex (extension) data. Using moddle to type it you’ll be able to

  • Access it via the moddle APIs
  • Validate it during diagram import
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.