terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.

Home Page:https://d2lang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UML Diagrams: Can't specify `shape`-class-attribute

kusnezoff-alexander opened this issue · comments

I am trying to model a class, which has a property named shape (defined by another library, so unfortunately I can't change its name).

The following workarounds don't work:

myclass: {
	shape: class
	# quote
        "shape": String
}

myclass: {
	shape: class
	# capitalize
        Shape: String
}

I always get the following error:

4:12: unknown shape "String"

It would be nice to somehow escape custom properties named shape 😀

Possible Solution

Add possibility to escape custom properties named shape in UML diagrams.

Steps to Reproduce

Try to compile one of these examples (eg in https://play.d2lang.com/)

myclass: {
	shape: class
	# quote
        "shape": String
}

myclass: {
	shape: class
	# capitalize
        Shape: String
}

Nvm: Adding visibility to the shape field solves the problem.

myclass: {
  shape: class
  +shape: a
}