mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Allow `erDiagram` entity names to be quoted strings.

Open ioquatix opened this issue 2 years ago • 2 comments

In some systems, entities can be nested in modules and namespaces. This is commonly written with two :: characters, but there are other ways including slashes, etc.

It would be nice to support this by allowing quoted strings as entity names.

e.g.

erDiagram
  "Service::User" {
    string name
    string password
  }

  "Service::Log" {
    string message
  }

  "Service::User" }o--o{ "Service::Log" : has_many

ioquatix avatar Jun 23 '22 03:06 ioquatix

There is the same issue in class diagrams, I would like to use brackets in the name

classDiagram
    "ShapeData<T>" <|-- classA

EDIT: i just realized there's a bracket escape for generics using ~

ceruulean avatar Jul 03 '22 12:07 ceruulean

I wish too to use the special charactor in erDiagram. Bracket is needed to show mysql column type.

erDiagram
    CAR {
        int8 allowedDriver FK "The license of the allowed driver"
    }
    
This is worked.
erDiagram
    CAR {
        int(8) allowedDriver FK "The license of the allowed driver"
        "int(8)" allowedDriver FK "The license of the allowed driver"
    }
    
Both line do not work with below error:
- Expecting 'ATTRIBUTE_WORD', got '('
- Expecting 'BLOCK_STOP', 'ATTRIBUTE_WORD', got 'COMMENT'

nabe1653 avatar Jul 28 '22 06:07 nabe1653

In Datomic-like databases (DataScript, XTDB, Datalevin...), the equivalent of table, column and column-type names are namespaced keywords, like :google.user/email, :db.type/uuid.

Furthermore, "column" definitions can have arbitrary attributes, but even the builtin attributes are numerous, so expecting only 4 columns is similarly unnecessarily limiting.

These drakonian limitation on the entity attribute syntax is overly limiting and would be wonderful, if it could be lifted!

Allowing quoting for all the fields would alleviate most of these problems and - I presume - wouldn't make the language syntax overly ambiguous.

onetom avatar Sep 15 '22 02:09 onetom