aboutsummaryrefslogtreecommitdiffstats
path: root/rust/codegen_openapi2.sh
blob: f7d1df538a6f07aa654285ddac8f9ea3c4106975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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

# 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

# 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

cargo fmt