kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
895 stars 237 forks source link

Quick Question: Can we parse a list of param in a PostgREST format ? #839

Open erwannb-pro opened 1 year ago

erwannb-pro commented 1 year ago

Hello,

I was wondering if there was a way to parse correctly and check for the keys in an openAPI specification when using a PostgREST format (e.g. : url.com?key=operator.value&key2=operator2.value2).

We currently have a project using express-openapi with types defined in specification files and we would like to use them to verify the keys and cast the values of our query parameters directly from OpenAPI.

The goal here would be to have a request with a PostgREST format that goes from :

GET url.com?reference=eq.123456

To :

And result in (or approximately) :

{"key" : "reference", "operator" : "eq", "value": "123456"}

Alternatively we could add the operator to the key, but then we would need to separate the key and the operator before checking if said key exists in our type.

Then we would need a result like :

{"key" : "reference.eq", "value": "123456"}

So is there a solution to manage this or are we in a case that's too complicated for a simple open-api specification file ?

I hope I made myself clear and else I can provide more examples and insights if needed.