Skip to content
New issue

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

Proposal: Add free-form 'tagging' of objects and relationships for plugin interpretation #566

Closed
GeertJohan opened this issue Dec 30, 2022 · 1 comment · Fixed by #772
Closed

Comments

@GeertJohan
Copy link

GeertJohan commented Dec 30, 2022

(Based on some brainstorms in discord, #feature-requests, 29 december)

As a plugin developer, I would like to define extra attributes for objects and relationships.
I could develop a plugin that renders d2 as a BMPN graph. I would then like to know which objects are a activity, which are a gateway, event, etc. This information is not encoded in d2's grammar. It's probably good to keep d2 agnostic about graph specifications such as UML and BPMN. But it would be nice if d2 could pass 'hints' to plugins, for which the interpretation is completely up to the plugin developer.

The way to do this currently would be to use comments. Ofcourse this is not very clean. And since it's not formally specified, prone to breaking changes.

An inspiration for this system may be how in the Go language struct fields are tagged. The Go languages doesn't know anything about json, but the encoding/json package can obtain information from a tag. json:"my_field"

customer `bpmn:"pool"` {
  purchase: Purchase item `bpmn:"task"`
}

cashier `bpmn:"pool"` {
  handle: Handle purchase `bmpn:"task"`
}


customer.purchase -> cashier.handle: Purchase an item `bpmn:"sequence"`
@cyborg-ts cyborg-ts added this to D2 Dec 30, 2022
@alixander
Copy link
Collaborator

i think we can just reuse class for this. @nhooyr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants