Giter Site home page Giter Site logo

Comments (8)

nikitastupin avatar nikitastupin commented on May 17, 2024

Hi @jondowsec,

Looking at the exception I conclude that clairvoyance wasn't able to recognize the suggestion because the suggestion uses ' and clairvoyance expects ".

Could you please add regexes to

wrong_field_regexes = [
(the same ones https://github.com/nikitastupin/clairvoyance/blob/33da27e9ba1b27bed9c28921869042e6c61551f3/clairvoyance/oracle.py#L375-376 except replace ' with ") and run against your GraphQL endpoint?

from clairvoyance.

jondowsec avatar jondowsec commented on May 17, 2024

I changed the " with ' and worked like a charm. Thank you.

from clairvoyance.

nikitastupin avatar nikitastupin commented on May 17, 2024

Cool! You may do a Pull Request with the changes you've made so others will benefit from your improvements 😃

from clairvoyance.

jondowsec avatar jondowsec commented on May 17, 2024

Small issue after leaving it for a while I get a TypeRef error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/clairvoyance/clairvoyance/__main__.py", line 97, in <module>
    wordlist, config, input_schema=input_schema, input_document=input_document
  File "/clairvoyance/clairvoyance/oracle.py", line 453, in clairvoyance
    typeref = probe_field_type(field_name, config, input_document)
  File "/clairvoyance/clairvoyance/oracle.py", line 342, in probe_field_type
    typeref = probe_typeref(documents, "Field", config)
  File "/clairvoyance/clairvoyance/oracle.py", line 329, in probe_typeref
    raise Exception(f"Unable to get TypeRef for {documents} in context {context}")
Exception: Unable to get TypeRef for ['query { bedding }', 'query { bedding { lol } }'] in context Field

If I send query{bedding} and query{bedding{lol}} directly I get this:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/clairvoyance/clairvoyance/__main__.py", line 97, in <module>
    wordlist, config, input_schema=input_schema, input_document=input_document
  File "/clairvoyance/clairvoyance/oracle.py", line 446, in clairvoyance
    typename = probe_typename(input_document, config)
  File "/clairvoyance/clairvoyance/oracle.py", line 392, in probe_typename
    raise Exception(f"Expected '{errors}' to match any of '{wrong_field_regexes}'.")
Exception: Expected '[{'message': "Cannot query field 'bedding' on type 'Query'.", 'code': 'GRAPHQL_VALIDATION_FAILED'}]' to match any of '['Cannot query field "imwrongfield" on type "(?P<typename>[_0-9a-zA-Z\\[\\]!]*)".', 'Field "[_0-9a-zA-Z\\[\\]!]*" must not have a selection since type "(?P<typename>[_A-Za-z\\[\\]!][_0-9a-zA-Z\\[\\]!]*)" has no subfields.', "Cannot query field 'imwrongfield' on type '(?P<typename>[_0-9a-zA-Z\\[\\]!]*)'.", "Field '[_0-9a-zA-Z\\[\\]!]*' must not have a selection since type '(?P<typename>[_A-Za-z\\[\\]!][_0-9a-zA-Z\\[\\]!]*)' has no subfields."]'.

But if I'm reading the above error correctly (which I most certainly might not), then it should be present in the wrong_field_regex array. What am I missing?

from clairvoyance.

nikitastupin avatar nikitastupin commented on May 17, 2024

I suppose it's again ' / " issue. You can add regexes with ' to https://github.com/nikitastupin/clairvoyance/blob/main/clairvoyance/oracle.py#L374-L377. It should fix the issue.

from clairvoyance.

nikitastupin avatar nikitastupin commented on May 17, 2024

I'm wrong. We've already fixed https://github.com/nikitastupin/clairvoyance/blob/main/clairvoyance/oracle.py#L374-L377. I think it's better to replace all " to ["'] in regexes so we won't have " / ' issue again.

from clairvoyance.

nikitastupin avatar nikitastupin commented on May 17, 2024

In particular https://github.com/nikitastupin/clairvoyance/blob/main/clairvoyance/oracle.py#L249-L261 most likely related to the latest issue.

from clairvoyance.

jondowsec avatar jondowsec commented on May 17, 2024

Yes, I also fixed it by setting " in the regex and it worked. Thanks.

from clairvoyance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.