Coder Social home page Coder Social logo

Comments (5)

soyuka avatar soyuka commented on July 28, 2024

Interesting, yeah it's a shame and I tried to move the getDescription forward by documenting it in the last release.

property is mainly used for https://www.hydra-cg.com/spec/latest/core/#templated-links and in the specification it is typed string, and I recently added the php doc:

* @return array<string, array{property?: string, type?: string, required?: bool, description?: string, strategy?: string, is_collection?: bool, swagger?: array<string, mixed>, openapi?: array<string, mixed>|\ApiPlatform\OpenApi\Model\Parameter, schema?: array<string, mixed>}>

In another change we now consider this as a string:

$k = str_replace(':property', $description['property'], $key);

Actually your filter should return an array per property supported:

$description = ['type' => SearchFilterInterface::STRATEGY_PARTIAL,
                'required' => false,
                'schema' => ['type' => 'string']];
return ['firstName' => ['property' => 'firstName'] + $description, 'lastName' => ['property' => 'lastName'] + $description, 'middleName' => ['property' => 'middleName'] + $description]; 

Not sure it had any impact earlier on, let me know if this leads to issues elsewhere.

from core.

ostrolucky avatar ostrolucky commented on July 28, 2024

I think I cannot do this, because key should be name of the query parameter, which in my case is name. When consumer does ?name=foo, filter will do firstName LIKE '%foo%' OR lastName LIKE '%foo%' OR middleName LIKE '%foo%', hence I documented ['name' => ['property' => ['firstName', 'lastName', 'middleName']],. If I split this to 3 filters with different key, this would indicate to consumer that they can do ?firstName=foo, ?lastName=foo, ?middleName=foo instead of ?name=foo, wouldn't it?

from core.

soyuka avatar soyuka commented on July 28, 2024

Yes indeed, I think I had a discussion with someone recently about this (probably at #5995 but can't find where). I think that what would be best would be to not set the property in your case as it has an impact only on the documentation.

from core.

ostrolucky avatar ostrolucky commented on July 28, 2024

Ok then removing it is! Thanks for being reactive. I guess this is something we would have to address to folks making the standard itself?

from core.

soyuka avatar soyuka commented on July 28, 2024

You mean hydra? Yeah I'm on the mailing list but it's quite cold for now :/.

from core.

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.