Coder Social home page Coder Social logo

Comments (1)

pquentin avatar pquentin commented on June 2, 2024 2

Hey @mpaluch92, thank you for your detailed bug report. You are right that passing a list of string is supported and that the type annotation is wrong. In fact, this was initially reported by @JannKleen in #2347, and I forgot to reopen the issue when I realized my fix had to be reverted.

The rest of this comment gives more technical details, but you can ignore them. I'll close this issue when I fix the bug.


The code that is wrong is generated from https://github.com/elastic/elasticsearch-specification. For mvt_search and the deprecated knn_search API, fields is typed as Fields, which boils down to a string or an array or strings. However, this is wrong, because those API also accept objects that define field but also format. For this reason, in the _search API, fields is typed as Array<FieldAndFormat>, with FieldAndFormat being a class. This seemed wrong, so I opened a pull request to change the type to Array<Field | FieldAndFormat>, but I had to revert it because the bug was in the code generator that was not taking into account shortcut_property instead to allow strings, not only mappings.

Long story short, I need to fix the (private) Python code generator to take into account shortcut_property and fix the type hints. In the meantime, you may need # pyright: ignore or # mypy: ignore annotations, sorry.

from elasticsearch-py.

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.