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

Whitespacing issues #281

Open
iilyak opened this issue Dec 29, 2022 · 1 comment
Open

Whitespacing issues #281

iilyak opened this issue Dec 29, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@iilyak
Copy link

iilyak commented Dec 29, 2022

Describe the bug
Adding whitespace to format the query in a readable way brakes the functionality

To Reproduce
Steps to reproduce the behavior:

  1. Create test.drawio.xml file as described bellow
  2. Issue the same query with different formatting
  3. Observe difference in behaviour
cat test.drawio.xml
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="Electron" modified="2022-12-27T16:51:00.393Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.7.4 Chrome/106.0.5249.199 Electron/21.3.3 Safari/537.36" etag="Chvfh0pmRcsiRFeLGn84" version="20.7.4" type="device">
  <diagram id="DIBkk8TONfjRhfH_ZR78" name="Page-1">
    <mxGraphModel dx="1114" dy="878" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0">
      <root>
        <mxCell id="0"/>
        <mxCell id="1" parent="0"/>
        <object label="" my_property="324" my_string="hello" id="vs0W597VZl1qWhmtER3h-1">
          <mxCell style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
            <mxGeometry x="100" y="200" width="120" height="60" as="geometry"/>
          </mxCell>
        </object>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

queries

working

❯ dasel -f test.drawio.xml -w json 'mxfile.diagram.mxGraphModel.root.all()
    .filter(and(equal(type(),object),equal(-my_property,324)))'

{
  "-id": "vs0W597VZl1qWhmtER3h-1",
  "-label": "",
  "-my_property": "324",
  "-my_string": "hello",
  "mxCell": {
    "-parent": "1",
    "-style": "rounded=0;whiteSpace=wrap;html=1;",
    "-vertex": "1",
    "mxGeometry": {
      "-as": "geometry",
      "-height": "60",
      "-width": "120",
      "-x": "100",
      "-y": "200"
    }
  }
}

not working

❯ dasel -f test.drawio.xml -w json 'mxfile.diagram.mxGraphModel.root
    .all()
    .filter(and(equal(type(),object),equal(-my_property,324)))'
❯ dasel -f test.drawio.xml -w json 'mxfile.diagram.mxGraphModel.root
  .all()
  .filter(
    and(
      equal(type(),object),
      equal(-my_property,324)
    )
  )'
dasel -f test.drawio.xml -w json 'mxfile.diagram.mxGraphModel.root.all()
  .filter(
    and(
      equal(type(),object),
      equal(-my_property,324)
    )
  )'

Expected behavior
I expect the same outpput regardless of query format

Desktop (please complete the following information):

  • OS: MacOS (M1)
  • Version: dasel version 2.0.2
@iilyak iilyak added the bug Something isn't working label Dec 29, 2022
@TomWright
Copy link
Owner

This is a known limitation right now.

I'll keep this issue open in the meantime while I work on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants