-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Autogenerated Rust Emily Client (#99)
* Add autogenerated rust client for Emily. * Add build.rs script to autogenerate emily client on build. * Add some comments to build.rs file * add npm install to build step and add periods to the error messages. * Add an init script to ignore the file that changes on build. * Add Smithy install step to GitHub workflow. * Fix build warnings and CI failure * Add dependency lock files * Add auto-built Cargo.toml to emily rust crate and remove script
- Loading branch information
1 parent
f509544
commit 62941ff
Showing
12 changed files
with
2,686 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "emily" | ||
version = "0.1.0" | ||
authors = ["OpenAPI Generator team and contributors"] | ||
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" | ||
# Override this license by providing a License Object in the OpenAPI. | ||
license = "Unlicense" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
serde = "^1.0" | ||
serde_derive = "^1.0" | ||
serde_json = "^1.0" | ||
url = "^2.2" | ||
uuid = { version = "^1.0", features = ["serde", "v4"] } | ||
aws-sigv4 = "0.3.0" | ||
http = "0.2.5" | ||
secrecy = "0.8.0" | ||
[dependencies.reqwest] | ||
version = "^0.11" | ||
features = ["json", "multipart"] |
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,47 @@ | ||
use std::process::Command; | ||
use std::env; | ||
|
||
fn main() { | ||
|
||
// Ensure that we rerun if the API changes. | ||
println!("cargo:rerun-if-changed=../../emily/api-definition/models"); | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
|
||
// Go to the api directory. | ||
let root_dir = env::current_dir().unwrap(); | ||
let emily_api_dir = root_dir | ||
.join("..") | ||
.join("..") | ||
.join("emily") | ||
.join("api-definition"); | ||
|
||
// Move execution location. | ||
assert!( | ||
env::set_current_dir(&emily_api_dir).is_ok(), | ||
"Couldn't change to the emily/api-definition directory.", | ||
); | ||
|
||
// Run `npm install`. | ||
let npm_install = Command::new("npm") | ||
.args(["install"]) | ||
.status() | ||
.expect("Failed to run `npm install`."); | ||
|
||
// Fail if the install command failed. | ||
assert!( | ||
npm_install.success(), | ||
"npm install failed.", | ||
); | ||
|
||
// Run `npm run build`. | ||
let npm_build = Command::new("npm") | ||
.args(["run", "build"]) | ||
.status() | ||
.expect("Failed to run `npm run build`."); | ||
|
||
// Fail if the build command failed. | ||
assert!( | ||
npm_build.success(), | ||
"npm run build failed.", | ||
); | ||
} |
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,3 @@ | ||
fn main() { | ||
// Dummy main so the crate is valid before `build.rs` runs. | ||
} |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
**/target | ||
**/.generated-sources | ||
**.log | ||
**/node_modules |
Oops, something went wrong.