Netflix TechBlog

Learn about Netflix’s world class engineering efforts, company culture, product developments and more.

Follow publication

Beyond REST

Netflix Technology Blog
Netflix TechBlog
Published in
8 min readFeb 22, 2021

GraphiQL: Auto-generated test GUI for the Star Wars API

Graphile

Database views as API

PostgreSQL composite types

postgres_test_db=# create view postgraphile.json_object_example as
select json_build_object(‘hello world’::text, 1, ‘2’::text, 3)
as json;
postgres_test_db=# select * from postgraphile.json_object_example;
json
— — — — — — — — — — — — -
{“hello world”: 1, “2”: 3}
(1 row)
postgres_test_db=# CREATE TYPE postgraphile.custom_type AS (
"hello world" integer,
"2" integer
);
postgres_test_db=# CREATE FUNCTION postgraphile.custom_type(
"hello world" integer,
"2" integer
)
RETURNS postgraphile.custom_type
AS 'select $1, $2'
LANGUAGE SQL;
postgres_test_db=# create view postgraphile.json_object_example2 as
select postgraphile.custom_type(1, 3)
as json;
postgres_test_db=# select * from postgraphile.json_object_example2;
json
— — — -
(1,3)
(1 row)
postgres_test_db=# comment on
type postgraphile.custom_type
is E’A description for the custom type’;
postgres_test_db=# comment on
view postgraphile.json_object_example2
is E’A description for the view’;
postgres_test_db=# comment on
column postgraphile.custom_type.”hello world”
is E’A description for hello world’;
postgres_test_db=# comment on
column postgraphile.custom_type.field_2
is E’@name field_two\nA description for the second field’;

Allow “full access” to the Graphile-generated schema (during development)

Conclusion

Published in Netflix TechBlog

Learn about Netflix’s world class engineering efforts, company culture, product developments and more.

Written by Netflix Technology Blog

Learn more about how Netflix designs, builds, and operates our systems and engineering organizations

Responses (10)

Write a response

I use Graphile every day and am very impressed with it. I hope Netflix is considering open source funding for Benjie, the creator of Graphile: https://github.com/benjie

--

Hi Netflix Engineering Team,
Very interesting approach! What made you decide on Graphile instead of Hasura or DGraph for example? Is it the smart comments and the approach to remove queries and mutations?
Hasura might even be an better option, since…

--

Intriguing approach to the audience! I find this awesome. I admit that netflix has helped me get through quarantine... :))) nice to know that you're developing something

--