API-first and Sanic

Hi @all,

as I’m willing to use Sanic with an api-first, contract-first methodology I stubbed a Sanic driver for connexion.

While it adds some overheads over Sanic, it adds a lot of checks (eg. schema validation, standardized error handling, …) and connexion with sanic seems faster than with other frameworks.

Is anybody interested?

Peace,
R.

That definitely sounds interesting. I know of connexion in concept, but not more than that. Is this a separate project or a driver on the main lib that plugs into Sanic instead of Flask? Where is the overhead? In routing or at startup?

Connexion is a project which dispatches API request based on OAS specifications.
It is done parsing OAS files and adding flask/sanic routes to a blueprint which is then added to the app.

Currently supports Flask and aiohttp. I wrote a basic Sanic driver.

Connexion validates every request parameter/body/header and eventually the response using jsonschema expressed in the OAS and provide a standard error-handling layout.

Request/Responses, that are translated to/from the framework: not a great connexion expert here, but probably using custom noop decorators we could skip some connexion features to increase speed. I think that if you have to validate deeply all sanic request/response you’ll slow down your Sanic app too.

If you have further questions please let me know!
Peace, R.