Files
vrchatapi-rust/generate.sh
DerTiedemann 2c4cf7d817 Bump openapi-generator to 7.7.0 (#14)
* bump: openapi-generator to 7.7.0

* fix: remove empty doc comments to silence clippy

* bump: remove unessecary patches fixed by the update

* bump: run generate.sh
2024-07-20 18:18:01 -06:00

31 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Generate Client
rm src/apis src/models docs -rf
./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
-g rust \
--additional-properties=packageName=vrchatapi,supportAsync=false \
--git-user-id=vrchatapi \
--git-repo-id=vrchatapi-rust \
-o . \
-i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \
--http-user-agent="vrchatapi-rust"
#--global-property debugOperations=true
# Update entire description (replace entire line, match the random data there) line in Cargo.toml
sed -i 's/^description = ".*"/description = "VRChat API Client for Rust"/' Cargo.toml
# Remove messily pasted markdown at top of every file
find src -type f -exec sed -i '/VRChat API Banner/d' {} \;
# Remove openapi version in every file
find src -type f -exec sed -i '/The version of the OpenAPI document/d' {} \;
# Remove empty doc comments
find src -type f -exec sed -i '/^\s*\/\/\/\s*$/d' {} \;
# Cookie storage
sed -i 's/Client::new()/Client::builder().cookie_store(true).build().unwrap()/g' src/apis/configuration.rs
sed -i 's/features = \["json", "blocking", "multipart"\]/features = \["json", "blocking", "cookies", "multipart"\]/g' Cargo.toml
cargo build