Repository: oxidecomputer/typify
Pull request #631 (2024-07-15 13:45:59)

Bump uuid from 1.9.1 to 1.10.0
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.9.1 to 1.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/uuid-rs/uuid/releases">uuid's releases</a>.</em></p>
<blockquote>
<h2>1.10.0</h2>
<h2>Deprecations</h2>
<p>This release deprecates and renames the following functions:</p>
<ul>
<li><code>Builder::from_rfc4122_timestamp</code> -&gt; <code>Builder::from_gregorian_timestamp</code></li>
<li><code>Builder::from_sorted_rfc4122_timestamp</code> -&gt; <code>Builder::from_sorted_gregorian_timestamp</code></li>
<li><code>Timestamp::from_rfc4122</code> -&gt; <code>Timestamp::from_gregorian</code></li>
<li><code>Timestamp::to_rfc4122</code> -&gt; <code>Timestamp::to_gregorian</code></li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>Use const identifier in uuid macro by <a href="https://github.com/Vrajs16"><code>@​Vrajs16</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/764">uuid-rs/uuid#764</a></li>
<li>Rename most methods referring to RFC4122 by <a href="https://github.com/Mikopet"><code>@​Mikopet</code></a> / <a href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/765">uuid-rs/uuid#765</a></li>
<li>prepare for 1.10.0 release by <a href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/766">uuid-rs/uuid#766</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/Vrajs16"><code>@​Vrajs16</code></a> made their first contribution in <a href="https://redirect.github.com/uuid-rs/uuid/pull/764">uuid-rs/uuid#764</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/uuid-rs/uuid/compare/1.9.1...1.10.0">https://github.com/uuid-rs/uuid/compare/1.9.1...1.10.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/uuid-rs/uuid/commit/4b4c590ae323b683a7ba80f05c83d3002ddc2fc5"><code>4b4c590</code></a> Merge pull request <a href="https://redirect.github.com/uuid-rs/uuid/issues/766">#766</a> from uuid-rs/cargo/1.10.0</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/68eff326408ea269253aa0ba8f6cb3ac4099f894"><code>68eff32</code></a> Merge pull request <a href="https://redirect.github.com/uuid-rs/uuid/issues/765">#765</a> from uuid-rs/chore/time-fn-deprecations</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/3d5384da4bfb2f35ad4426440d285e4a13c8c011"><code>3d5384d</code></a> update docs and deprecation messages for timestamp fns</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/de50f2091f05a973b4e8ca2f7eddd03459b1b680"><code>de50f20</code></a> renaming rfc4122 functions</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/4a8841792a8bb7007d23a54fa866adc5cec79425"><code>4a88417</code></a> prepare for 1.10.0 release</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/66b4fcef14862bc5d8d45acb9f6683a37fa5ecb4"><code>66b4fce</code></a> Merge pull request <a href="https://redirect.github.com/uuid-rs/uuid/issues/764">#764</a> from Vrajs16/main</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/8896e26c421a8b9a7a935acf83d291df40256de9"><code>8896e26</code></a> Use expr instead of ident</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/09973d6aff62b61ec35f577a757148007deb5f05"><code>09973d6</code></a> Added changes</li>
<li><a href="https://github.com/uuid-rs/uuid/commit/6edf3e8cd59351589622daf1f2634870d90896e3"><code>6edf3e8</code></a> Use const identifer in uuid macro</li>
<li>See full diff in <a href="https://github.com/uuid-rs/uuid/compare/1.9.1...1.10.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uuid&package-manager=cargo&previous-version=1.9.1&new-version=1.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 0427573..5981901 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1267,9 +1267,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
 
 [[package]]
 name = "uuid"
-version = "1.9.1"
+version = "1.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
+checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
 dependencies = [
  "serde",
 ]
diff --git a/typify-impl/Cargo.toml b/typify-impl/Cargo.toml
index ac6782c..45a22b4 100644
--- a/typify-impl/Cargo.toml
+++ b/typify-impl/Cargo.toml
@@ -30,4 +30,4 @@ rustfmt-wrapper = "0.2.1"
 schema = "0.1.0"
 schemars = { version = "0.8.21", features = ["uuid1", "impl_json_schema"] }
 syn = { version = "2.0.69", features = ["full", "extra-traits"] }
-uuid = "1.9.1"
+uuid = "1.10.0"
diff --git a/typify-impl/src/convert.rs b/typify-impl/src/convert.rs
index ac8a7a0..553cd96 100644
--- a/typify-impl/src/convert.rs
+++ b/typify-impl/src/convert.rs
@@ -79,8 +79,8 @@ impl TypeSpace {
                     let enum_values = enum_values.clone().map(|values| {
                         values
                             .iter()
+                            .filter(|&value| !value.is_null())
                             .cloned()
-                            .filter(|value| !value.is_null())
                             .collect()
                     });
                     let ss = Schema::Object(SchemaObject {
@@ -515,8 +515,29 @@ impl TypeSpace {
                     else_schema: None,
                 } => self.convert_not(type_name, original_schema, metadata, subschema),
 
-                // Unknown
-                _ => todo!("{:#?}", subschemas),
+                // Multiple subschemas may be present at the same time; attempt
+                // to merge and then convert.
+                subschemas => {
+                    // Remove the subschemas so we can merge into the rest.
+                    let schema_object = SchemaObject {
+                        subschemas: None,
+                        ..schema.clone()
+                    };
+                    let merged_schema = try_merge_with_subschemas(
+                        schema_object,
+                        Some(subschemas),
+                        &self.definitions,
+                    );
+                    match merged_schema {
+                        Ok(s) => {
+                            let (type_entry, _) =
+                                self.convert_schema_object(type_name, original_schema, &s)?;
+                            Ok((type_entry, &None))
+                        }
+                        // An error indicates that the schema is unresolvable.
+                        Err(_) => self.convert_never(type_name, original_schema),
+                    }
+                }
             },
 
             // Subschemas with other stuff.
diff --git a/typify-impl/src/util.rs b/typify-impl/src/util.rs
index 4b92d68..06efe0f 100644
--- a/typify-impl/src/util.rs
+++ b/typify-impl/src/util.rs
@@ -243,7 +243,8 @@ fn schemas_mutually_exclusive(a: &Schema, b: &Schema) -> bool {
                     {
                         object_schemas_mutually_exclusive(a_validation, b_validation)
                     } else {
-                        todo!()
+                        // Could check further, but we'll be conservative.
+                        false
                     }
                 }
 
@@ -286,7 +287,8 @@ fn schemas_mutually_exclusive(a: &Schema, b: &Schema) -> bool {
                     {
                         array_schemas_mutually_exclusive(a_validation, b_validation)
                     } else {
-                        todo!()
+                        // Could check further, but we'll be conservative.
+                        false
                     }
                 }
 
diff --git a/typify/Cargo.toml b/typify/Cargo.toml
index 3f57c7d..25ac81a 100644
--- a/typify/Cargo.toml
+++ b/typify/Cargo.toml
@@ -29,4 +29,4 @@ schemars = "0.8.21"
 serde = "1.0.204"
 serde_json = "1.0.120"
 trybuild = "1.0.97"
-uuid = { version = "1.9.1", features = ["serde"] }
+uuid = { version = "1.10.0", features = ["serde"] }


Test patch:
diff --git a/typify/tests/schemas/merged-schemas.json b/typify/tests/schemas/merged-schemas.json
index bbdb512..a98e937 100644
--- a/typify/tests/schemas/merged-schemas.json
+++ b/typify/tests/schemas/merged-schemas.json
@@ -417,6 +417,36 @@
           }
         }
       ]
+    },
+    "HereAndThere": {
+      "allOf": [
+        {
+          "type": "object",
+          "properties": {
+            "foo": {
+              "type": "string"
+            }
+          }
+        }
+      ],
+      "oneOf": [
+        {
+          "type": "object",
+          "properties": {
+            "bar": {
+              "type": "string"
+            }
+          }
+        },
+        {
+          "type": "object",
+          "properties": {
+            "baz": {
+              "type": "string"
+            }
+          }
+        }
+      ]
     }
   }
-}
\ No newline at end of file
+}
diff --git a/typify/tests/schemas/merged-schemas.rs b/typify/tests/schemas/merged-schemas.rs
index ea090cf..aae6261 100644
--- a/typify/tests/schemas/merged-schemas.rs
+++ b/typify/tests/schemas/merged-schemas.rs
@@ -113,6 +113,64 @@ impl From<&CommentedTypeMerged> for CommentedTypeMerged {
         value.clone()
     }
 }
+#[doc = "HereAndThere"]
+#[doc = r""]
+#[doc = r" <details><summary>JSON schema</summary>"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = "  \"allOf\": ["]
+#[doc = "    {"]
+#[doc = "      \"type\": \"object\","]
+#[doc = "      \"properties\": {"]
+#[doc = "        \"foo\": {"]
+#[doc = "          \"type\": \"string\""]
+#[doc = "        }"]
+#[doc = "      }"]
+#[doc = "    }"]
+#[doc = "  ],"]
+#[doc = "  \"oneOf\": ["]
+#[doc = "    {"]
+#[doc = "      \"type\": \"object\","]
+#[doc = "      \"properties\": {"]
+#[doc = "        \"bar\": {"]
+#[doc = "          \"type\": \"string\""]
+#[doc = "        }"]
+#[doc = "      }"]
+#[doc = "    },"]
+#[doc = "    {"]
+#[doc = "      \"type\": \"object\","]
+#[doc = "      \"properties\": {"]
+#[doc = "        \"baz\": {"]
+#[doc = "          \"type\": \"string\""]
+#[doc = "        }"]
+#[doc = "      }"]
+#[doc = "    }"]
+#[doc = "  ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" </details>"]
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum HereAndThere {
+    Variant0 {
+        #[serde(default, skip_serializing_if = "Option::is_none")]
+        bar: Option<String>,
+        #[serde(default, skip_serializing_if = "Option::is_none")]
+        foo: Option<String>,
+    },
+    Variant1 {
+        #[serde(default, skip_serializing_if = "Option::is_none")]
+        baz: Option<String>,
+        #[serde(default, skip_serializing_if = "Option::is_none")]
+        foo: Option<String>,
+    },
+}
+impl From<&HereAndThere> for HereAndThere {
+    fn from(value: &HereAndThere) -> Self {
+        value.clone()
+    }
+}
 #[doc = "JsonResponseBase"]
 #[doc = r""]
 #[doc = r" <details><summary>JSON schema</summary>"]