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

Export-PSGraph fails when a node is called "graph" #30

Closed
dchristian3188 opened this issue Jun 14, 2017 · 3 comments
Closed

Export-PSGraph fails when a node is called "graph" #30

dchristian3188 opened this issue Jun 14, 2017 · 3 comments
Assignees

Comments

@dchristian3188
Copy link

Steps to reproduce:

Graph testGraph {
    node 'cat'
    node 'Graph'
    node 'dog'    
} | Export-PSGraph -ShowGraph
@KevinMarquette
Copy link
Owner

Other node names that cause this:

  • node
  • edge
  • subgraph
  • digraph

The first error message is coming from graphviz when it parses the graph output.

Error: <stdin>: syntax error in line 7 near '}'

I suspect all DOT keywords would cause this failure.

@dchristian3188
Copy link
Author

What do you think about changing this section in Format-Value?

 # Normal value, no quotes
                '^[\w]+$'
                {
                    '"{0}"' -f $value
                }

I ran through some quick tests and it seems to resolve the issue.

@KevinMarquette
Copy link
Owner

There are two scenarios that I would need to look at that I may as well document here and get some tests added.

The first one is setting note (or edge) attribute defaults.

 Graph testGraph {
    node @{shape='rect'}
    node 'cat'
    node 'dog'    
 } | Export-PSGraph -ShowGraph

If that first node gets quotes around it, it becomes a real node instead of defining the attributes for the other nodes. In one case you would get two squares and in the other, you would get one square and two circles.

I did notice that custom format scripts are causing issues like this too, so I opened #32 to track it. I'm going to look to see how easy it would be to pull that special case out of the normal format logic.

The second is edges to record nodes.

graph g {
    node @{shape='record'}
    node struct1 @{shape='record';label=" left|<f1> middle|<f2> right"}
    node struct2 @{shape='record';label="<f0> one| two"}
    node struct3 @{shape='record';label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"}
    edge struct1:f1 -to struct2:f0
    edge struct1:f2 -to struct3:here
} | Export-PSGraph -ShowGraph

The edge in this example may need some more analysis. I don't have any documentation on record nodes and edges, but I want to maintain that underlying engine compatibility.

I am tempted to add a way to turn that off though and that may be a better discussion in another thread. As it stands, it gets in the way of edges to uri and server:port named nodes.

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

No branches or pull requests

2 participants