Add option for overriding root spec (#1317)
* Only for pg >= 9.6 * Disallow specifying schema on root-spec * Increase memory test upper bound
This commit is contained in:
Vendored
+33
@@ -1680,3 +1680,36 @@ create function add_them(a integer, b integer)
|
||||
returns integer as $$
|
||||
select a + b;
|
||||
$$ language sql;
|
||||
|
||||
create function root() returns jsonb as $_$
|
||||
declare
|
||||
openapi jsonb = $$
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info":{
|
||||
"title":"PostgREST API",
|
||||
"description":"This is a dynamic API generated by PostgREST"
|
||||
}
|
||||
}
|
||||
$$;
|
||||
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;
|
||||
else
|
||||
return openapi;
|
||||
end case;
|
||||
end
|
||||
$_$ language plpgsql;
|
||||
|
||||
Reference in New Issue
Block a user