Repository: GREsau/schemars (rust)

Issue:
`Option` no longer has a default of null as of v0.8.18
In schemars v0.8.17, an `Option` with a default of `None` results in `"default": null`.

```rust
use schemars::{schema_for, JsonSchema};

#[derive(JsonSchema, Default)]
#[schemars(default = "Self::default")]
pub struct MyStruct {
    pub my_int: Option<i32>,
}

fn main() {
    let schema = schema_for!(MyStruct);
    println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
```

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "MyStruct",
  "type": "object",
  "properties": {
    "my_int": {
      "default": null,
      "type": [
        "integer",
        "null"
      ],
      "format": "int32"
    }
  }
}
```

In schemars v0.8.18 (and the latest v0.8.20), the same `Option` has no default.

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "MyStruct",
  "type": "object",
  "properties": {
    "my_int": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32"
    }
  }
}
```

I'm not sure if this was an intentional change, but it seems to me like having `"default": null` would be more expected, especially given that the example used the `#[schemars(default = "Self::default")]` attribute.

Pull request description:
Fix "null" default not being set on schema
Fixes #295

Patch:
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs
index 657244b..5b03178 100644
--- a/schemars/src/_private.rs
+++ b/schemars/src/_private.rs
@@ -161,7 +161,7 @@ pub mod metadata {
     add_metadata_fn!(add_deprecated, deprecated, bool);
     add_metadata_fn!(add_read_only, read_only, bool);
     add_metadata_fn!(add_write_only, write_only, bool);
-    add_metadata_fn!(add_default, default, Value);
+    add_metadata_fn!(add_default, default, Option<Value>);
 
     pub fn add_examples<I: IntoIterator<Item = Value>>(schema: Schema, examples: I) -> Schema {
         let mut schema_obj = schema.into_object();


Test patch:
diff --git a/schemars/tests/default.rs b/schemars/tests/default.rs
index fbc1033..ab489f5 100644
--- a/schemars/tests/default.rs
+++ b/schemars/tests/default.rs
@@ -30,6 +30,7 @@ where
 struct MyStruct {
     my_int: i32,
     my_bool: bool,
+    my_optional_string: Option<String>,
     #[serde(serialize_with = "custom_serialize")]
     my_struct2: MyStruct2,
     #[serde(
diff --git a/schemars/tests/expected/default.json b/schemars/tests/expected/default.json
index aefef83..4155d53 100644
--- a/schemars/tests/expected/default.json
+++ b/schemars/tests/expected/default.json
@@ -12,6 +12,13 @@
       "default": false,
       "type": "boolean"
     },
+    "my_optional_string": {
+      "default": null,
+      "type": [
+        "string",
+        "null"
+      ]
+    },
     "my_struct2": {
       "default": "i:0 b:false",
       "allOf": [