graphql-perl - plugin to make GraphQL "just work" with OpenAPI
The just-released v0.03 of GraphQL::Plugin::Convert::OpenAPI provides a plugin to convert a given OpenAPI specification (the spec formerly known as Swagger) to a GraphQL schema.
There is also now a sample OpenAPI applet for Mojolicious::Lite. It provides a GraphQL interface to the superb CPAN Testers REST API. Here is an example query:
{
v3_report_get(id: "a35ce723-6bf8-1014-858b-1fdf904013f2") {
id
created
reporter {
name
}
}
}
And this is the code that implements it in the applet:
plugin GraphQL => {
convert => [ 'OpenAPI', 'cpantesters-v3.json' ],
graphiql => 1,
};
The porting of GraphQL to Perl 5 has been sponsored by Perl Careers.
I blog about Perl.
Leave a comment