Open Manuelbaun opened 2 years ago
No, this is currently not possible, except for the OpenAPI output on the root endpoint. But this will describe the whole schema, not a single endpoint. And it will also not take the currently requested embedding into account.
How would you expect to query the server to get this result?
Hey, sorry for the late reply.
I though of an query endpoint, for sending a query, which analyse it and resolves the query return type by sending the structure, based on the schema loaded from postgres.
an post request to an endpoint /queries with a structure like
{
"query": "\people?select=full_name,birth_date,address(*)
}
Alternatively:
\queries?table=people&select=select=full_name,birth_date,address(*)
\people?select=full_name,birth_date,address(*)\json-doc
would some of them work?
Unfortunately, I am not familiar with haskell at all. Its probably worth to ask the community, if such a feature is actually of interesst or just not relevant.
Looks related to https://github.com/PostgREST/postgrest/issues/1421
This is not a bug report, rather a question.
Is it possible to get a response json schema for a specific query? Assume this query:
/people?select=full_name,birth_date
. The expected response:Imagine writing down the queries and then generate the response type as a json schema. From there, every language can generate their interfaces, classes, DTO etc. The above-mentioned example is rather simple. But if you would use embedded resources etc., this would be actually very nice feature. Since you already have implemented the query parser with all its intricacies.
I think GraphQl does something similar, where a generator generated the response type by a defined query.