askql icon indicating copy to clipboard operation
askql copied to clipboard

Object cannot be used as value in query?

Open mhagmajer opened this issue 4 years ago • 3 comments

Screenshot 2020-07-02 at 12 55 11

ask {
  query {
    firstName1: { a:1 }
    firstName2: ({ a:1 })
  }
}

Returned object is empty, but { "a": 1 } was expected

mhagmajer avatar Jul 02 '20 10:07 mhagmajer

@czerwinskilukasz1 what do you think about it? Does it make sense to mix the query and value semantics like this? Where should we place a border between query and regular value expression?

mhagmajer avatar Oct 09 '20 12:10 mhagmajer

I am for allowing this kind of syntax. Why do we permit strings or ints but would forbid dictionaries? @mhagmajer , did you do research why it doesn't work? Is it parser or askcode/askvm?

czerwinskilukasz1 avatar Oct 16 '20 13:10 czerwinskilukasz1

Adding this test case here:

// TODO :: should we make this work?
  // it(`should return an object`, async function () {
  //   const expectedObjectValue = {
  //     objectReturned: values.objectValue,
  //   };
  //
  //   const queryForAnObjectValue = `query(node('objectReturned',f(object('a',call(get('get'),'objectValue')))))`;
  //
  //   await expect(ask(queryForAnObjectValue)).resolves.toStrictEqual(
  //     expectedObjectValue
  //   );
  // });

YonatanKra avatar Oct 16 '20 13:10 YonatanKra