-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(bors): merge pull request #879
879: refactor(openapi/rust): use paperclip as code generator r=tiagolobocastro a=tiagolobocastro We can now stop using our fork and use paperclip which allows us to keep the templates locally on openapi/templates. Co-authored-by: Tiago Castro <[email protected]>
- Loading branch information
Showing
70 changed files
with
2,604 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ lib, sources, pkgs }: | ||
let | ||
src_json = lib.importJSON ./source.json; | ||
hostPlatform = pkgs.rust.toRustTargetSpec pkgs.pkgsStatic.stdenv.hostPlatform; | ||
in | ||
pkgs.stdenv.mkDerivation { | ||
pname = src_json.repo; | ||
version = src_json.rev; | ||
|
||
src = pkgs.fetchurl { | ||
name = "paperclip-${src_json.rev}.tar.gz"; | ||
url = "https://github.com/${src_json.owner}/${src_json.repo}/releases/download/${src_json.rev}/paperclip-${hostPlatform}.tar.gz"; | ||
sha256 = src_json.hash; | ||
}; | ||
|
||
sourceRoot = "."; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install -m755 -D paperclip-ng $out/bin/paperclip-ng | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/${src_json.owner}/${src_json.repo}"; | ||
description = "OpenApi v3 Generator"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"owner": "paperclip-rs", | ||
"repo": "paperclip", | ||
"rev": "v0.9.4", | ||
"hash": "sha256-DIt+09p4TnTQq4b9ZNdq9f08Yiqc+Llco6B7zceX5FU=" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[package] | ||
name = "{{{packageName}}}" | ||
version = "{{{packageVersion}}}" | ||
edition = "{{{packageEdition}}}" | ||
|
||
[lib] | ||
name = "{{{packageLibname}}}" | ||
path = "src/lib.rs" | ||
|
||
[features] | ||
default = [ "tower-client-rls", "tower-trace" ] | ||
actix-server = [ "actix" ] | ||
actix-client = [ "actix", "actix-web-opentelemetry", "awc" ] | ||
actix = [ "actix-web", "rustls" ] | ||
tower-client-rls = [ "tower-client", "rustls_feat" ] | ||
tower-client-tls = [ "tower-client", "hyper_tls_feat" ] | ||
tower-client = [ "tower-hyper" ] | ||
tower-hyper = [ "hyper", "tower", "tower-http", "http-body", "futures", "pin-project", "tokio" ] | ||
hyper_tls_feat = [ "hyper-tls", "tokio-native-tls" ] | ||
rustls_feat = [ "rustls", "webpki", "hyper-rustls" ] | ||
tower-trace = [ "opentelemetry-jaeger", "tracing-opentelemetry", "opentelemetry", "opentelemetry-http", "tracing", "tracing-subscriber" ] | ||
|
||
[dependencies] | ||
serde = "^1.0" | ||
serde_derive = "^1.0" | ||
serde_json = "^1.0" | ||
url = { version = "^2.4", features = ["serde"] } | ||
async-trait = "0.1.73" | ||
dyn-clonable = "0.9.0" | ||
uuid = { version = "1.4.1", features = ["serde", "v4"] } | ||
serde_urlencoded = "0.7" | ||
|
||
# actix dependencies | ||
actix-web = { version = "4.4.0", features = ["rustls-0_21"], optional = true } | ||
actix-web-opentelemetry = { version = "0.17.0", optional = true } | ||
awc = { version = "3.2.0", optional = true } | ||
|
||
# tower and hyper dependencies | ||
hyper = { version = "0.14.27", features = [ "client", "http1", "http2", "tcp", "stream" ], optional = true } | ||
tower = { version = "0.4.13", features = [ "timeout", "util", "limit" ], optional = true } | ||
tower-http = { version = "0.4.4", features = [ "trace", "map-response-body", "auth" ], optional = true } | ||
tokio = { version = "1.32.0", features = ["full"], optional = true } | ||
http-body = { version = "0.4.5", optional = true } | ||
futures = { version = "0.3.28", optional = true } | ||
pin-project = { version = "1.1.3", optional = true } | ||
|
||
# SSL | ||
rustls = { version = "0.21.12", optional = true, features = [ "dangerous_configuration" ] } | ||
rustls-pemfile = "1.0.3" | ||
webpki = { version = "0.22.2", optional = true } | ||
hyper-rustls = { version = "0.24.1", optional = true } | ||
hyper-tls = { version = "0.5.0", optional = true } | ||
tokio-native-tls = { version = "0.3.1", optional = true } | ||
|
||
# tracing and telemetry | ||
opentelemetry-jaeger = { version = "0.21.0", features = ["rt-tokio-current-thread"], optional = true } | ||
tracing-opentelemetry = { version = "0.23.0", optional = true } | ||
opentelemetry = { version = "0.22.0", optional = true } | ||
opentelemetry-http = { version = "0.11.1", optional = true } | ||
tracing = { version = "0.1.37", optional = true } | ||
tracing-subscriber = { version = "0.3.18", optional = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Rust API client for {{{packageName}}} | ||
|
||
{{#appDescriptionWithNewLines}} | ||
{{{appDescriptionWithNewLines}}} | ||
{{/appDescriptionWithNewLines}} | ||
|
||
## Overview | ||
|
||
- API version: {{{appVersion}}} | ||
- Package version: {{{packageVersion}}} | ||
{{^hideGenerationTimestamp}} | ||
- Build date: {{{generatedDate}}} | ||
{{/hideGenerationTimestamp}} | ||
- Build package: {{{generatorClass}}} | ||
{{#infoUrl}} | ||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
{{/infoUrl}} | ||
|
||
## Installation | ||
|
||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`: | ||
|
||
``` | ||
openapi = { path = "./generated" } | ||
``` | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *{{{basePath}}}* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{{classname}}}* | [**{{{operationId}}}**]({{{apiDocPath}}}{{classname}}.md#{{{operationIdLowerCase}}}) | **{{{httpMethod}}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}} | ||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} | ||
|
||
## Documentation For Models | ||
|
||
{{#models}}{{#model}} - [{{{classname}}}]({{{modelDocPath}}}{{{classname}}}.md) | ||
{{/model}}{{/models}} | ||
|
||
To get access to the crate's generated documentation, use: | ||
|
||
``` | ||
cargo doc --open | ||
``` | ||
|
||
## Author | ||
|
||
{{#apiInfo}}{{#apis}}{{#-last}}{{{infoEmail}}} | ||
{{/-last}}{{/apis}}{{/apiInfo}} |
Oops, something went wrong.