Consider a use case where I have a URL like
/api/v1?credentials="test"&age=20&gender=male
Now how can I have 2 different type of cases
USE CASE-1
How can I accept the above query parameters in the form a class from swagger, I know we can define this in swagger as different individual parameters something like this
parameters:
- in: query
name: credentials
schema:
type: string
- in: query
name: age
schema:
type: integer
- in: query
name: gender
schema:
type: string
but with this swagger creates a rest method with string or integer parameters, and having so many multiple parameters might not be a good idea so what I strongly expect is that it creates a class something like shown below, and my rest methods are generated with this class object. And how can I leverage this class into my controller layer?
class Query{
String name;
Integer age;
String gender;
}
USE CASE-2
Is there some way I can accept all these query params into the form of a hashMap or multiValueMap I know there is another integer in the above url query params, but for now, lets consider I will accept all these params into the form of a string and will later typecast them as per my requirement.
NOTE - that I don't want the same name parameter with multiple values, I am expecting all the query parameters with or without the same names to be mapped into one string-to-string key-value pair.
So let's say when I had to access them I will directly use something like map.get("age")