seamia / protodot

transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)
BSD 3-Clause "New" or "Revised" License
410 stars 39 forks source link

Assert: *** Failed to process file json data, error: invalid character '}' looking for beginning of object key string #6

Closed Soenhay closed 3 years ago

Soenhay commented 3 years ago

I just downloaded the program and created a basic config file. I also installed Graphviz. Following are the details:

Command: protodot.exe -src protoFileName.proto

config.json:

{
    "locations": {
        "graphviz": "C:\\Program Files\\Graphviz 2.44.1\\bin"
    },
    "options": {
        "generate .png file": true,
        "generate .svg file": false,
    }
}

Error message:

Assert: *** Failed to process file json data, error: invalid character '}' looking for beginning of object key string
Error: failed to load config file
Soenhay commented 3 years ago

The graphviz option needs the full path to the dot.exe.

I changed the config file to be a copy of the one in the repo except for my paths and now I get this error:

creating file: C:\Users\username/protodot/generated/149393ff8bdcb33d.dot
generating .svg file
error on exec exit status 1
generating .png file
error on exec exit status 1

config.json:

{
"documentation": "https://github.com/seamia/protodot",
    "settings": {
        "orientation":      "LR",
        "node.shape":       "plaintext",
        "node.font.size":   "10",
        "node.font.name":   "Ubuntu",

        "text.align.header":    "right",
        "text.align.sequence":  "right",
        "text.align.name":  "left",
        "text.align.type":  "right",
        "text.align.repeat":    "right",
        "text.align.value": "left",
        "text.align.oneof": "left",

        "node.prefix":      "Node_"
    },
    "templates": {
        "document.header":  "file:templates/begin.tmpl",
        "entry":        "file:templates/entry.tmpl",
        "document.footer":  "file:templates/end.tmpl",

        "service.prefix":   "file:oneline:templates/service_prefix.tmpl",
        "service.rpc":      "file:oneline:templates/service_rpc.tmpl",
        "service.suffix":   "file:templates/service_suffix.tmpl",

        "cluster.prefix":   "file:templates/subgraph_begin.tmpl",
        "cluster.entry":    "file:templates/subgraph_entry.tmpl",
        "cluster.suffix":   "file:templates/subgraph_end.tmpl",

        "from.to.message":  "file:templates/to_message.tmpl",
        "from.to.enum":     "file:templates/to_enum.tmpl",
        "from.to.missing":  "file:templates/to_missing.tmpl",

        "message.prefix":   "file:oneline:templates/message_prefix.tmpl",
        "message.suffix":   "file:templates/message_suffix.tmpl",

        "entry.simple":     "file:oneline:templates/entry_simple.tmpl",
        "entry.enum":       "file:oneline:templates/entry_enum.tmpl",
        "entry.message":    "file:oneline:templates/entry_message.tmpl",
        "entry.missing":    "file:oneline:templates/entry_missing.tmpl",

        "enum.prefix":      "file:oneline:templates/enum_prefix.tmpl",
        "enum.entry":       "file:oneline:templates/enum_entry.tmpl",
        "enum.suffix":      "file:templates/enum_suffix.tmpl",

        "map.simple":       "file:oneline:templates/map_simple.tmpl",
        "map.enum":     "file:oneline:templates/map_enum.tmpl",
        "map.message":      "file:oneline:templates/map_message.tmpl",
        "map.missing":      "file:oneline:templates/map_missing.tmpl",

        "oneof.entry.prefix":   "file:oneline:templates/oneof_entry_prefix.tmpl",
        "oneof.entry.simple":   "file:oneline:templates/oneof_entry_simple.tmpl",
        "oneof.entry.enum": "file:oneline:templates/oneof_entry_enum.tmpl",
        "oneof.entry.message":  "file:oneline:templates/oneof_entry_message.tmpl",
        "oneof.entry.missing":  "file:oneline:templates/oneof_entry_missing.tmpl",
        "oneof.entry.suffix":   "file:oneline:templates/oneof_entry_suffix.tmpl",

        "imports.header":   "file:templates/begin.tmpl",
        "imports.node":     "file:templates/import_node.tmpl",
        "imports.node.missing": "file:templates/import_node_missing.tmpl",
        "imports.connection":   "file:templates/import_link.tmpl",
        "imports.footer":   "file:templates/end.tmpl",

        "missing.node":     "file:templates/missing_node.tmpl",
        "comment":      "file:templates/comment.tmpl"
    },
    "colors": {
        "background":       "white",
        "text":         "black",
        "cluster.background":   "darkolivegreen1",
        "cluster.text":     "black",
        "relationship.message": "black",
        "relationship.enum":    "green",
        "oneof.background": "paired9:6",
        "type.simple":      "paired9:0",
        "type.enum":        "paired9:2",
        "type.message":     "paired9:4",
        "type.missing":     "greys9:3",
        "message.background":   "floralwhite",
        "message.header":   "paired9:5",
        "enum.background":  "paired9:2",
        "enum.header":      "paired9:3",
        "service.background":   "gold",
        "service.return":   "coral",
        "service.header":   "coral",
        "relationship.missing": "greys9:5",
        "missing.header":   "greys9:4",
        "missing.background":   "greys9:2"
    },
    "locations": {
        "graphviz": "C:\\Program Files\\Graphviz 2.44.1\\bin\\dot.exe",
        "generated":    "${HOME}/protodot/generated",
        "templates":    "${config.dir}",
        "downloads":    "${HOME}/protodot/downloads",
        "action":       ""
    },
    "options": {
        "allow missing imports":    true,
        "show missing types":       true,
        "generate .png file":       true,
        "generate .svg file":       true,
        "suppress all output":      false
    },
    "includes": [
        "${HOME}/protodot/protoc-3.6.0/include",
        "${GOPATH}/src/github.com/gogo/protobuf",
        "${GOPATH}/src"
    ]
}
Soenhay commented 3 years ago

I tried running dot manually like this and got another error:

>"C:\\Program Files\\Graphviz\\bin\\dot.exe" -v
dot - graphviz version 2.44.1 (20200629.0846)
There is no layout engine support for "dot"
Perhaps "dot -c" needs to be run (with installer's privileges) to register the plugins?

Then ran it again with admin privilege's and it it worked.

After doing that, the first command in this post works and the images are generated at ${HOME}/protodot/generate.

Pretty cool!