feat: request.spec GUC for db-root-spec
The request.spec GUC contains the schema cache structure in json. It's only available when the root endpoint(/) is requested and when db-root-spec is not empty. Also correct db-root-spec to accept a schema.
This commit is contained in:
committed by
Steve Chavez
parent
f169661ce6
commit
d99909c403
Vendored
+3
-13
@@ -1713,9 +1713,9 @@ returns integer as $$
|
||||
select a + b;
|
||||
$$ language sql;
|
||||
|
||||
create function root() returns jsonb as $_$
|
||||
create or replace function root() returns json as $_$
|
||||
declare
|
||||
openapi jsonb = $$
|
||||
openapi json = $$
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info":{
|
||||
@@ -1724,22 +1724,12 @@ openapi jsonb = $$
|
||||
}
|
||||
}
|
||||
$$;
|
||||
simple jsonb = $$
|
||||
[
|
||||
{
|
||||
"table":"items"
|
||||
},
|
||||
{
|
||||
"table":"subitems"
|
||||
}
|
||||
]
|
||||
$$;
|
||||
begin
|
||||
case current_setting('request.header.accept', true)
|
||||
when 'application/openapi+json' then
|
||||
return openapi;
|
||||
when 'application/json' then
|
||||
return simple;
|
||||
return (current_setting('request.spec', true)::json)->'dbRelationships'->0->'relTable';
|
||||
else
|
||||
return openapi;
|
||||
end case;
|
||||
|
||||
Reference in New Issue
Block a user