0
votes

I set up a basic JHipster project and generated an entity that supports filtering with JDL. The generator made a Swagger API which I use for querying the database. The Swagger API doc shows me a list of parameters which can be used to build query. The template query looks like this: GET /api/client?name.equals=john&surname.equals=doe&country.in=uk&country.in=de

The request works fine but the parameters are chained like name==john OR surname==doe OR country==uk OR country==de so I get all johns, does, and everoyne from uk and de. This is ok, but for some queries i need name==john AND surname==doe so not all Johns and Does but specifically John Doe. I searched here and on the swagger forum but couldn't find the answer.

My question is: how do I achieve changing the OR to AND in the query? Does this swagger query support AND or do I have to make changes in the backend?

1

1 Answers

0
votes

Your question is not about swagger, this is why you could not find anything in swagger forum.

It's about JHipster JPA entity filtering and the answer is no: you can't generate code that would use a OR.

You must code it yourself, look at the *QueryService classes and assemble your criteria with the logic you need.