Implement JsonSchema on Url
This commit is contained in:
parent
3a2b425998
commit
f0836d4415
6 changed files with 66 additions and 0 deletions
14
schemars/tests/expected/url.json
Normal file
14
schemars/tests/expected/url.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "UrlTypes",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
}
|
||||
}
|
14
schemars/tests/url.rs
Normal file
14
schemars/tests/url.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
mod util;
|
||||
use schemars::JsonSchema;
|
||||
use url::Url;
|
||||
use util::*;
|
||||
|
||||
#[derive(Debug, JsonSchema)]
|
||||
struct UrlTypes {
|
||||
url: Url,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn url_types() -> TestResult {
|
||||
test_default_generated_schema::<UrlTypes>("url")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue