Commit Graph

633 Commits

Author SHA1 Message Date
Darksome
11dc2ef170 Map 'any' JSON Schema type to json::Value instead of String 2022-12-31 09:12:08 +01:00
Gary Coady
bd24ea872a Improve handling of plurals in generator.
The generator tries to turn plural into singular nouns.
However, some words turn out badly, including:
 - Addresse (from Addresses)
 - Prefixe (from Prefixes)
 - Bookshelve (from Bookshelves)
 - Sery (from Series)

By using a library, we can get a slightly better outcome.
I've added an exception for "Data", because seeing that
turned into "Datum" is a bit jarring.
2022-11-29 22:51:05 +01:00
Sebastian Thiel
2f38895f83 update common dependencies to latest version
There were some (breaking) changes in these dependencies and the
required versions changed.

On the bright side, both common crates are now in the 5.0 range.
2022-10-20 13:35:14 +08:00
philippeitis
05fc10b0c4 Fix clippy lint in preproc 2022-10-19 20:30:19 -07:00
philippeitis
9c9c17b923 Fix default values in CLI crates 2022-10-19 20:30:04 -07:00
philippeitis
852bd70ecb Move error checking earlier 2022-10-19 18:42:15 -07:00
philippeitis
83007472c9 Fix stringly typed upload protocol 2022-10-19 18:25:58 -07:00
philippeitis
0ad3b1258f Refactor Params into external struct
Reduces file size of generated library:

```
cargo build --release
   Compiling google-compute1 v5.0.1+20220224 (/home/philippe/PycharmProjects/google-apis-rs/gen/compute1)
    Finished release [optimized] target(s) in 35.15s
```
164 MB resulting lib (4MB reduction)
2022-10-19 17:10:24 -07:00
philippeitis
9fa31bd034 Don't call .to_string() on string values 2022-10-19 15:44:48 -07:00
philippeitis
a6e763f495 Use top-level constants for upload protocols 2022-10-19 15:17:08 -07:00
philippeitis
cfa6958aa0 Add UploadProtocol enum to remove string types 2022-10-19 15:13:20 -07:00
philippeitis
ae3e6a232b Simplify search for alt=json param 2022-10-19 15:00:16 -07:00
philippeitis
eb072087de Use Cow for parameter replacement 2022-10-18 20:04:09 -07:00
philippeitis
925d7b0376 Reduce number of clones 2022-10-18 19:28:48 -07:00
philippeitis
f6b195df4f Make MultiPartReader::mime_type associated fn 2022-10-18 16:58:26 -07:00
philippeitis
616b324a77 Update mime 2022-10-18 16:25:08 -07:00
Sebastian Thiel
fb884e193a Merge branch 'auth-refactor' 2022-10-18 15:50:11 +08:00
philippeitis
c6439ee165 Remove .expect() 2022-10-16 21:38:06 -07:00
philippeitis
a375b710b1 Use Result<Option<_>, _> 2022-10-16 21:26:21 -07:00
philippeitis
02dbcb9782 Fix lib.rs docs 2022-10-16 17:25:46 -07:00
philippeitis
7ca7f1cafd Make yup-oauth2 optional 2022-10-16 17:19:10 -07:00
philippeitis
32110d6970 Return Option<String> from GetToken::get_token instead of Result<...> 2022-10-16 16:35:34 -07:00
Sebastian Thiel
869a50e64a fix typo 2022-10-16 20:28:47 +08:00
philippeitis
a8d5b2e6d9 Link hub in resource builder docs 2022-10-14 22:41:36 -07:00
philippeitis
3183af080a Refactor modification of scopes
`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.

Refactor modification of scopes

`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.

Refactor modification of scopes

`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.
2022-10-14 22:04:40 -07:00
philippeitis
24f361749a Use .to_string() directly for reduction in build size
Went from 3,325,128b to 3,287,744b for accessapproval1 by using .to_string() directly, under --release config.
2022-10-10 17:37:16 -07:00
philippeitis
98a02a73a4 Simplify searching for "alt=json" param 2022-10-10 17:14:43 -07:00
philippeitis
d611a319de Fix bug in removing used parameters
The current implementation removes parameters if they are used - however, it only removes the first instance, and removes instances by index. However, when multiple items are being removed, following indices must be decremented by 1 to account for previously removed items.
2022-10-10 17:13:38 -07:00
philippeitis
fa1c5a84ec Use BTreeSet instead of BTreeMap 2022-10-10 17:08:58 -07:00
Sebastian Thiel
913087c1dc use google-apis-common 5.0 for good measure 2022-10-10 09:25:33 +08:00
philippeitis
59874c9c98 Remove indentation 2022-10-10 00:53:24 +00:00
philippeitis
1c04f662d1 Use correct string impls for http headers 2022-10-09 00:04:30 -07:00
philippeitis
a1041d6e16 Fix serde_as not reporting changed member types 2022-10-08 23:12:36 -07:00
philippeitis
f6cced9605 Support serde for arbitrary field types
This introduces the `serde_with` dependency and `rust_type.py`, to allow supporting arbitrary types for serialization.
Since fields may have arbitrary types (eg. `HashMap<_, chrono::Duration>`) which need deserialization, it is necessary to
use type-based serialization to avoid implementing (de)serialization for every permutation of types that require special serialization.
However, `serde` does not let you (de)serialize one type as another (eg. `chrono::Duration` as `Wrapper`) - thus necessitating `serde_with`, which does. `rust_type.py` introduces the `RustType` class, which makes it easy to describe the (de)serialization type used by `serde_with`
2022-10-08 23:01:30 -07:00
philippeitis
8cc2707563 Fix cargo check w.r.t. FieldMask
The serde traits are now directly implemented for FieldMask - this helps address potential serde issues with wrapper types, and simplifies the serde process somewhat.
2022-10-08 19:59:23 -07:00
philippeitis
ddac761e06 Add #[serde(default)] for Option parsing
If using #[serde(with = ...)] with an Option type, serde will expect all marked fields to be present. Adding #[serde(default)] restores expected behaviour - if no Option value is present, None will be used.
2022-10-08 15:50:47 -07:00
philippeitis
d043fd67b9 Include references to definitions of types 2022-10-08 12:56:54 -07:00
philippeitis
a2d16944cd Make format fully supported 2022-10-08 12:36:59 -07:00
philippeitis
2f3972036c Remove unnecessary examples for ref types 2022-10-08 03:24:47 -07:00
philippeitis
afb96bd264 Add FieldMask and serde impl 2022-10-08 03:22:08 -07:00
philippeitis
5398dc6f79 refactor serde functionality into separate module 2022-10-08 00:51:59 -07:00
philippeitis
23dd5d7c24 chrono example types 2022-10-07 21:46:03 -07:00
philippeitis
158e52399e Use UTC DateTime 2022-10-07 21:35:05 -07:00
philippeitis
66db5c892d Use type constructors for examples 2022-10-07 21:27:13 -07:00
philippeitis
1f10077e44 Find sources for appropriate types 2022-10-07 20:59:51 -07:00
philippeitis
44882a3c44 use chrono::Duration instead of custom client type 2022-10-07 20:44:31 -07:00
philippeitis
6ced748cb1 Fix tested type 2022-10-07 20:38:41 -07:00
philippeitis
05df68de32 Use chrono::Duration directly with serde attributes 2022-10-07 20:34:40 -07:00
philippeitis
29aa8df15b Use appropriate types for date-time, duration, bytes 2022-10-07 13:36:03 -07:00
philippeitis
3d831bcdc6 Use type specified by format key where possible 2022-10-06 22:57:48 -07:00