Swagger-codegen: [New Generator] Rust API client generator

Created on 22 Jun 2017  路  10Comments  路  Source: swagger-api/swagger-codegen

Description

We want to generate Rust API client so that Rust programmers can consume REST APIs more easily with Rust.

cc @frol

Swagger-codegen version

Latest master

Suggest a Fix

If anyone wants to contribute the generator or help out, please reply to let us know.

(You don't need to know Java in order to contribute the generator)

Rust New generator help wanted

Most helpful comment

There are still some outstanding issues (not least a merge conflict), but I've just opened https://github.com/swagger-api/swagger-codegen/pull/6613 so we can start the conversation.

All 10 comments

You don't need to know Java in order to contribute the generator

Why am I deep into java code now, then? 馃槃

On a serious note: I'm working on rust client generator based on hyper.rs.

The PowerShell API client generator was created with the help of an experienced PowerShell developer who does not know Java.

We can start the same process if you're interested in creating a Rust client generator in Swagger Codegen.

I'd be up for any help in re. java code (I can reasonably read java). Can do the rust part.

@farcaller thanks for offering help on this.

We can reuse the same methodology we used for PowerShell API client by first creating a Rust wrapper/SDK for PetStore by focusing on a few endpoints.

The Rust code can be put in the folder samples/client/petstore/rust.

Then we can reverse-engineer the Rust code to create the mustache templates and the generator in Java.

SGTM. I'll work on the example and will submit a PR

There you go: https://github.com/swagger-api/swagger-codegen/pull/6092

It almost works with the sample node server (it actually crashes the server, but I'm very sure it's the server's fault).

As trailed in https://github.com/swagger-api/swagger-codegen/pull/6105#issuecomment-320300513, we've now released an alternative implementation of Rust codegen - https://github.com/Metaswitch/swagger-codegen (the rust branch).

It's sufficiently feature-complete that we will be imminently using it in production, though there are still some rough edges.

How should we proceed? In https://github.com/swagger-api/swagger-codegen/pull/6105#issuecomment-320300513, it was suggested that the two implementations could co-exist. Ours is currently named rust2 to make that easier.

@BenjaminGill-Metaswitch thanks! Please file a PR against master.

About the naming, rust2 is ok but I would prefer something like "rust-{http_lib_name}". For example, we've "typescript-jquery" for Typescript generators in which jquery is the "http_lib_name".

@BenjaminGill-Metaswitch do you need help filing the PR? Anything else the community can help out with?

There are still some outstanding issues (not least a merge conflict), but I've just opened https://github.com/swagger-api/swagger-codegen/pull/6613 so we can start the conversation.

Was this page helpful?
0 / 5 - 0 ratings