#generator #api #backward #evolution #clean #compatible #apivolve

apivolve_generator_api

Api for creating generators for Apivolve, an API evolution tool that helps keep your APIs backwards compatible yet clean

2 releases

0.1.1 Apr 30, 2023
0.1.0 Mar 22, 2022

#1547 in Database interfaces

29 downloads per month
Used in apivolve

Apache-2.0

47KB
1.5K SLoC

Apivolve generator API

This project is part of Apivolve, a project to describe api changes in evolution files.

The api description is automatically converted to code for parsing, including full backwards compatibility. This is done by generators for each language, which can be written fully independently from the main Apivolve repo.

This project is for if you want to use Rust to create your own Apivolve generator. You can use any other language you want; in that case, you parse the json yourself and do not need this library (example).

This repository contains:

  • The Rust types that Apivolve uses to describe the API
  • The boilerplate code for requesting and parsing this data in Rust.
  • Examples of simple generators in a few languages.

Protocol v1

Version 1 is currently the latest/only version.

Communication happens over a localhost TCP connection.

EDIT: support embedded (Rust) only for now, and then bootstrap the protocol with Apivolve itself

  • Apivolve runs the generator executable, with tcp address as argument.
  • The generator sends the configuration it expects to use (AcceptedFormat).
  • Apivolve sends the generator options, such as output directory and arguments (UserPreferences).
  • The generator sends the features and parties it wants, with (FunctionalityRequest).
  • Apivolve sends the requested information per version, one version at a time, from new to old.
  • For each of those, the generator generates the necessary code, and persists it.
  • Apivolve indicates that all versions have been sent, and the generator exits.

Dependencies

~1.8–3MB
~59K SLoC