summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-09-05 19:04:34 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-09-05 19:04:34 -0700
commitba722671b4791524384010705bef0aaa83c22c0b (patch)
tree9d546b87a36cfa521d8a64ea032948416c9e6314
parenta65dfc914517376b5ededb82e594236c5d61c721 (diff)
downloadfatcat-ba722671b4791524384010705bef0aaa83c22c0b.tar.gz
fatcat-ba722671b4791524384010705bef0aaa83c22c0b.zip
rename rust crate fatcat-api-spec -> fatcat-openapi
-rw-r--r--rust/Cargo.lock4
-rw-r--r--rust/Cargo.toml4
-rwxr-xr-xrust/codegen_openapi2.sh22
-rw-r--r--rust/fatcat-openapi/.cargo/config (renamed from rust/fatcat-api-spec/.cargo/config)0
-rw-r--r--rust/fatcat-openapi/.gitignore (renamed from rust/fatcat-api-spec/.gitignore)0
-rw-r--r--rust/fatcat-openapi/Cargo.toml (renamed from rust/fatcat-api-spec/Cargo.toml)2
-rw-r--r--rust/fatcat-openapi/README.md (renamed from rust/fatcat-api-spec/README.md)2
-rw-r--r--rust/fatcat-openapi/api.yaml (renamed from rust/fatcat-api-spec/api.yaml)0
-rw-r--r--rust/fatcat-openapi/api/swagger.yaml (renamed from rust/fatcat-api-spec/api/swagger.yaml)0
-rw-r--r--rust/fatcat-openapi/examples/ca.pem (renamed from rust/fatcat-api-spec/examples/ca.pem)0
-rw-r--r--rust/fatcat-openapi/examples/client.rs (renamed from rust/fatcat-api-spec/examples/client.rs)0
-rw-r--r--rust/fatcat-openapi/examples/server-chain.pem (renamed from rust/fatcat-api-spec/examples/server-chain.pem)0
-rw-r--r--rust/fatcat-openapi/examples/server-key.pem (renamed from rust/fatcat-api-spec/examples/server-key.pem)0
-rw-r--r--rust/fatcat-openapi/examples/server.rs (renamed from rust/fatcat-api-spec/examples/server.rs)0
-rw-r--r--rust/fatcat-openapi/examples/server_lib/mod.rs (renamed from rust/fatcat-api-spec/examples/server_lib/mod.rs)0
-rw-r--r--rust/fatcat-openapi/examples/server_lib/server.rs (renamed from rust/fatcat-api-spec/examples/server_lib/server.rs)0
-rw-r--r--rust/fatcat-openapi/rustfmt.toml (renamed from rust/fatcat-api-spec/rustfmt.toml)0
-rw-r--r--rust/fatcat-openapi/src/client.rs (renamed from rust/fatcat-api-spec/src/client.rs)0
-rw-r--r--rust/fatcat-openapi/src/lib.rs (renamed from rust/fatcat-api-spec/src/lib.rs)0
-rw-r--r--rust/fatcat-openapi/src/mimetypes.rs (renamed from rust/fatcat-api-spec/src/mimetypes.rs)0
-rw-r--r--rust/fatcat-openapi/src/models.rs (renamed from rust/fatcat-api-spec/src/models.rs)0
-rw-r--r--rust/fatcat-openapi/src/server.rs (renamed from rust/fatcat-api-spec/src/server.rs)0
-rw-r--r--rust/src/auth.rs2
-rw-r--r--rust/src/database_models.rs2
-rw-r--r--rust/src/editing.rs2
-rw-r--r--rust/src/editing_crud.rs2
-rw-r--r--rust/src/endpoint_handlers.rs4
-rw-r--r--rust/src/endpoints.rs8
-rw-r--r--rust/src/entity_crud.rs2
-rw-r--r--rust/src/errors.rs2
-rw-r--r--rust/tests/helpers.rs6
-rw-r--r--rust/tests/test_refs.rs2
32 files changed, 33 insertions, 33 deletions
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index d2c4cf6f..38f1bf29 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -538,7 +538,7 @@ dependencies = [
"dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "fatcat-api-spec 0.3.0",
+ "fatcat-openapi 0.3.0",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -566,7 +566,7 @@ dependencies = [
]
[[package]]
-name = "fatcat-api-spec"
+name = "fatcat-openapi"
version = "0.3.0"
dependencies = [
"bodyparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index eb861f9b..e590ca20 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -7,10 +7,10 @@ description = "A scalable, versioned, API-oriented catalog for bibliographic ent
license = "AGPL 3.0"
[workspace]
-members = ["fatcat-api-spec"]
+members = ["fatcat-openapi"]
[dependencies]
-fatcat-api-spec = {version = "*", path = "fatcat-api-spec", features = ["server"] }
+fatcat-openapi = {version = "*", path = "fatcat-openapi", features = ["server"] }
diesel = { version = "1.3", features = ["postgres", "uuid", "serde_json", "chrono", "r2d2"] }
diesel_migrations = "1.3"
dotenv = "0.9.0"
diff --git a/rust/codegen_openapi2.sh b/rust/codegen_openapi2.sh
index 715326d5..f0b48a47 100755
--- a/rust/codegen_openapi2.sh
+++ b/rust/codegen_openapi2.sh
@@ -1,19 +1,19 @@
#!/bin/sh
-cargo swagger ../fatcat-openapi2.yml fatcat-api-spec --docker-tag=v2.3.1
-sudo chown `whoami`:`whoami` -R fatcat-api-spec
-git checkout fatcat-api-spec/Cargo.toml
+cargo swagger ../fatcat-openapi2.yml fatcat-openapi --docker-tag=v2.3.1
+sudo chown `whoami`:`whoami` -R fatcat-openapi
+git checkout fatcat-openapi/Cargo.toml
# Hack to handle "extra" JSON fields
-sed -i 's/Object/serde_json::Value/g' fatcat-api-spec/src/models.rs
-sed -i 's/extern crate uuid;/extern crate serde_json;\nextern crate uuid;/g' fatcat-api-spec/src/models.rs
+sed -i 's/Object/serde_json::Value/g' fatcat-openapi/src/models.rs
+sed -i 's/extern crate uuid;/extern crate serde_json;\nextern crate uuid;/g' fatcat-openapi/src/models.rs
# Hack to fix "release_date" as Date, not DateTime
-sed -i 's/release_date: Option<chrono::DateTime<chrono::Utc>>/release_date: Option<chrono::NaiveDate>/g' fatcat-api-spec/src/models.rs
-sed -i 's/withdrawn_date: Option<chrono::DateTime<chrono::Utc>>/withdrawn_date: Option<chrono::NaiveDate>/g' fatcat-api-spec/src/models.rs
+sed -i 's/release_date: Option<chrono::DateTime<chrono::Utc>>/release_date: Option<chrono::NaiveDate>/g' fatcat-openapi/src/models.rs
+sed -i 's/withdrawn_date: Option<chrono::DateTime<chrono::Utc>>/withdrawn_date: Option<chrono::NaiveDate>/g' fatcat-openapi/src/models.rs
# Hack to optionally log unknown request fields (not actually needed)
-#sed -i 's/\(response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));\)/\1 warn!("unknown fields in request body: {:?}", unused_elements);/g' fatcat-api-spec/src/server.rs
+#sed -i 's/\(response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));\)/\1 warn!("unknown fields in request body: {:?}", unused_elements);/g' fatcat-openapi/src/server.rs
# Hack to require that optional params parse correctly (boolean, integer, datetime)
# If we reformat, this this should basically go from, eg:
@@ -23,8 +23,8 @@ sed -i 's/withdrawn_date: Option<chrono::DateTime<chrono::Utc>>/withdrawn_date:
# .and_then(|x| Some(x.parse::<i64>()))
# .map_or_else(|| Ok(None), |x| x.map(|v| Some(v)))
# .map_err(|x| Response::with((status::InternalServerError, "unparsable query parameter (expected integer)".to_string())))?;
-sed -i 's/.and_then(|x| x.parse::<i64>().ok());$/.and_then(|x| Some(x.parse::<i64>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected integer)".to_string())))?;/g' fatcat-api-spec/src/server.rs
-sed -i 's/.and_then(|x| x.parse::<bool>().ok());$/.and_then(|x| Some(x.to_lowercase().parse::<bool>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?;/g' fatcat-api-spec/src/server.rs
-sed -i 's/.and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());$/.and_then(|x| Some(x.parse::<chrono::DateTime<chrono::Utc>>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected UTC datetime in ISO\/RFC format)".to_string())))?;/g' fatcat-api-spec/src/server.rs
+sed -i 's/.and_then(|x| x.parse::<i64>().ok());$/.and_then(|x| Some(x.parse::<i64>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected integer)".to_string())))?;/g' fatcat-openapi/src/server.rs
+sed -i 's/.and_then(|x| x.parse::<bool>().ok());$/.and_then(|x| Some(x.to_lowercase().parse::<bool>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?;/g' fatcat-openapi/src/server.rs
+sed -i 's/.and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());$/.and_then(|x| Some(x.parse::<chrono::DateTime<chrono::Utc>>())).map_or_else(|| Ok(None), |x| x.map(|v| Some(v))).map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected UTC datetime in ISO\/RFC format)".to_string())))?;/g' fatcat-openapi/src/server.rs
cargo fmt
diff --git a/rust/fatcat-api-spec/.cargo/config b/rust/fatcat-openapi/.cargo/config
index b8acc9c0..b8acc9c0 100644
--- a/rust/fatcat-api-spec/.cargo/config
+++ b/rust/fatcat-openapi/.cargo/config
diff --git a/rust/fatcat-api-spec/.gitignore b/rust/fatcat-openapi/.gitignore
index a9d37c56..a9d37c56 100644
--- a/rust/fatcat-api-spec/.gitignore
+++ b/rust/fatcat-openapi/.gitignore
diff --git a/rust/fatcat-api-spec/Cargo.toml b/rust/fatcat-openapi/Cargo.toml
index 9d416bd9..835b9a8b 100644
--- a/rust/fatcat-api-spec/Cargo.toml
+++ b/rust/fatcat-openapi/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "fatcat-api-spec"
+name = "fatcat-openapi"
version = "0.3.0"
authors = ["Bryan Newbold <bnewbold@archive.org>"]
description = "HTTP API models, endpoints, and other auto-generated types"
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-openapi/README.md
index b175a762..9565e2c7 100644
--- a/rust/fatcat-api-spec/README.md
+++ b/rust/fatcat-openapi/README.md
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 0.3.0
-- Build date: 2019-05-21T18:36:07.221Z
+- Build date: 2019-09-06T02:00:55.433Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-openapi/api.yaml
index 95ef4c6b..95ef4c6b 100644
--- a/rust/fatcat-api-spec/api.yaml
+++ b/rust/fatcat-openapi/api.yaml
diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-openapi/api/swagger.yaml
index b4c5e657..b4c5e657 100644
--- a/rust/fatcat-api-spec/api/swagger.yaml
+++ b/rust/fatcat-openapi/api/swagger.yaml
diff --git a/rust/fatcat-api-spec/examples/ca.pem b/rust/fatcat-openapi/examples/ca.pem
index d2317fb5..d2317fb5 100644
--- a/rust/fatcat-api-spec/examples/ca.pem
+++ b/rust/fatcat-openapi/examples/ca.pem
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-openapi/examples/client.rs
index 3cb0df50..3cb0df50 100644
--- a/rust/fatcat-api-spec/examples/client.rs
+++ b/rust/fatcat-openapi/examples/client.rs
diff --git a/rust/fatcat-api-spec/examples/server-chain.pem b/rust/fatcat-openapi/examples/server-chain.pem
index 47d7e201..47d7e201 100644
--- a/rust/fatcat-api-spec/examples/server-chain.pem
+++ b/rust/fatcat-openapi/examples/server-chain.pem
diff --git a/rust/fatcat-api-spec/examples/server-key.pem b/rust/fatcat-openapi/examples/server-key.pem
index 29c00682..29c00682 100644
--- a/rust/fatcat-api-spec/examples/server-key.pem
+++ b/rust/fatcat-openapi/examples/server-key.pem
diff --git a/rust/fatcat-api-spec/examples/server.rs b/rust/fatcat-openapi/examples/server.rs
index 8d2e9b64..8d2e9b64 100644
--- a/rust/fatcat-api-spec/examples/server.rs
+++ b/rust/fatcat-openapi/examples/server.rs
diff --git a/rust/fatcat-api-spec/examples/server_lib/mod.rs b/rust/fatcat-openapi/examples/server_lib/mod.rs
index bf404d49..bf404d49 100644
--- a/rust/fatcat-api-spec/examples/server_lib/mod.rs
+++ b/rust/fatcat-openapi/examples/server_lib/mod.rs
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-openapi/examples/server_lib/server.rs
index c9f92d33..c9f92d33 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-openapi/examples/server_lib/server.rs
diff --git a/rust/fatcat-api-spec/rustfmt.toml b/rust/fatcat-openapi/rustfmt.toml
index cba42c2b..cba42c2b 100644
--- a/rust/fatcat-api-spec/rustfmt.toml
+++ b/rust/fatcat-openapi/rustfmt.toml
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-openapi/src/client.rs
index 378c546f..378c546f 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-openapi/src/client.rs
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-openapi/src/lib.rs
index b19b5793..b19b5793 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-openapi/src/lib.rs
diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-openapi/src/mimetypes.rs
index 0676f63b..0676f63b 100644
--- a/rust/fatcat-api-spec/src/mimetypes.rs
+++ b/rust/fatcat-openapi/src/mimetypes.rs
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-openapi/src/models.rs
index c8b68328..c8b68328 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-openapi/src/models.rs
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-openapi/src/server.rs
index 102b6e41..102b6e41 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-openapi/src/server.rs
diff --git a/rust/src/auth.rs b/rust/src/auth.rs
index 1a006ffd..b88a72b0 100644
--- a/rust/src/auth.rs
+++ b/rust/src/auth.rs
@@ -18,7 +18,7 @@ use crate::server::*;
use chrono::prelude::*;
use diesel;
use diesel::prelude::*;
-use fatcat_api_spec::models::{Editgroup, Editor};
+use fatcat_openapi::models::{Editgroup, Editor};
use std::collections::HashMap;
use std::env;
use std::str::FromStr;
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 79b0137b..e4bca2b0 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -4,7 +4,7 @@ use crate::database_schema::*;
use crate::errors::*;
use crate::identifiers::uuid2fcid;
use chrono::Utc;
-use fatcat_api_spec::models::{
+use fatcat_openapi::models::{
ChangelogEntry, Editgroup, EditgroupAnnotation, Editor, EntityEdit, ReleaseRef,
};
use serde_json;
diff --git a/rust/src/editing.rs b/rust/src/editing.rs
index 65cd5bb8..4890b231 100644
--- a/rust/src/editing.rs
+++ b/rust/src/editing.rs
@@ -11,7 +11,7 @@ use crate::identifiers::FatcatId;
use crate::server::DbConn;
use diesel;
use diesel::prelude::*;
-use fatcat_api_spec::models::*;
+use fatcat_openapi::models::*;
pub struct EditContext {
pub editor_id: FatcatId,
diff --git a/rust/src/editing_crud.rs b/rust/src/editing_crud.rs
index 2526ef2b..8da3cabd 100644
--- a/rust/src/editing_crud.rs
+++ b/rust/src/editing_crud.rs
@@ -5,7 +5,7 @@ use crate::errors::*;
use crate::identifiers::{self, FatcatId};
use crate::server::DbConn;
use diesel::prelude::*;
-use fatcat_api_spec::models::*;
+use fatcat_openapi::models::*;
use std::str::FromStr;
use uuid::Uuid;
diff --git a/rust/src/endpoint_handlers.rs b/rust/src/endpoint_handlers.rs
index a44861ee..64b6ed62 100644
--- a/rust/src/endpoint_handlers.rs
+++ b/rust/src/endpoint_handlers.rs
@@ -14,8 +14,8 @@ use crate::errors::*;
use crate::identifiers::*;
use crate::server::*;
use diesel::prelude::*;
-use fatcat_api_spec::models;
-use fatcat_api_spec::models::*;
+use fatcat_openapi::models;
+use fatcat_openapi::models::*;
macro_rules! entity_auto_batch_handler {
($post_auto_batch_handler:ident, $model:ident) => {
diff --git a/rust/src/endpoints.rs b/rust/src/endpoints.rs
index a762fe18..2f30a7fa 100644
--- a/rust/src/endpoints.rs
+++ b/rust/src/endpoints.rs
@@ -17,9 +17,9 @@ use crate::identifiers::FatcatId;
use crate::server::*;
use cadence::prelude::*;
use diesel::Connection;
-use fatcat_api_spec::models;
-use fatcat_api_spec::models::*;
-use fatcat_api_spec::*;
+use fatcat_openapi::models;
+use fatcat_openapi::models::*;
+use fatcat_openapi::*;
use futures::{self, Future};
use sentry::integrations::failure::capture_fail;
use std::cmp;
@@ -62,7 +62,7 @@ macro_rules! generic_err_responses {
}
/// Helper for generating wrappers (which return "Box::new(futures::done(Ok(BLAH)))" like the
-/// codegen fatcat-api-spec code wants) that call through to actual helpers (which have simple
+/// codegen fatcat-openapi code wants) that call through to actual helpers (which have simple
/// Result<> return types)
macro_rules! wrap_entity_handlers {
// Would much rather just have entity ident, then generate the other fields from that, but Rust
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs
index 3a1597ec..c0c9e30b 100644
--- a/rust/src/entity_crud.rs
+++ b/rust/src/entity_crud.rs
@@ -14,7 +14,7 @@ use crate::identifiers::*;
use crate::server::DbConn;
use diesel::prelude::*;
use diesel::{self, insert_into};
-use fatcat_api_spec::models::*;
+use fatcat_openapi::models::*;
use sha1::Sha1;
use std::marker::Sized;
use std::str::FromStr;
diff --git a/rust/src/errors.rs b/rust/src/errors.rs
index cb53e6d1..e18e660f 100644
--- a/rust/src/errors.rs
+++ b/rust/src/errors.rs
@@ -15,7 +15,7 @@
pub use failure::Error;
use failure::Fail;
-use fatcat_api_spec::models;
+use fatcat_openapi::models;
use std::result;
/// A type alias for handling errors throughout this crate
diff --git a/rust/tests/helpers.rs b/rust/tests/helpers.rs
index d0b0b6d3..918dbe5c 100644
--- a/rust/tests/helpers.rs
+++ b/rust/tests/helpers.rs
@@ -2,7 +2,7 @@ use fatcat::auth::MacaroonAuthMiddleware;
use fatcat::editing_crud::EditgroupCrud;
use fatcat::identifiers::FatcatId;
use fatcat::server;
-use fatcat_api_spec::models::Editgroup;
+use fatcat_openapi::models::Editgroup;
use iron::headers::{Authorization, Bearer, ContentType};
use iron::mime::Mime;
use iron::{status, Chain, Headers};
@@ -28,9 +28,9 @@ pub fn setup_http() -> (
.create_token(admin_id, None)
.unwrap();
- let router = fatcat_api_spec::router(server);
+ let router = fatcat_openapi::router(server);
let mut chain = Chain::new(router);
- chain.link_before(fatcat_api_spec::server::ExtractAuthData);
+ chain.link_before(fatcat_openapi::server::ExtractAuthData);
chain.link_before(MacaroonAuthMiddleware::new());
let mut headers = Headers::new();
let mime: Mime = "application/json".parse().unwrap();
diff --git a/rust/tests/test_refs.rs b/rust/tests/test_refs.rs
index 28dfd6b8..ced89828 100644
--- a/rust/tests/test_refs.rs
+++ b/rust/tests/test_refs.rs
@@ -5,7 +5,7 @@ use fatcat::editing::{accept_editgroup, make_edit_context};
use fatcat::entity_crud::{EntityCrud, HideFlags};
use fatcat::identifiers::FatcatId;
use fatcat::server;
-use fatcat_api_spec::models::*;
+use fatcat_openapi::models::*;
use std::str::FromStr;
use uuid::Uuid;