Support for #[schemars(crate = "...")] (#80)
This commit is contained in:
parent
ebd7ff32ce
commit
b2b733ba5c
6 changed files with 87 additions and 10 deletions
19
schemars/tests/crate_alias.rs
Normal file
19
schemars/tests/crate_alias.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
mod util;
|
||||
use ::schemars as not_schemars;
|
||||
use util::*;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std as schemars;
|
||||
|
||||
#[derive(Debug, not_schemars::JsonSchema)]
|
||||
#[schemars(crate = "not_schemars")]
|
||||
pub struct Struct {
|
||||
/// This is a document
|
||||
foo: i32,
|
||||
bar: bool,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_crate_alias() -> TestResult {
|
||||
test_default_generated_schema::<Struct>("crate_alias")
|
||||
}
|
19
schemars/tests/expected/crate_alias.json
Normal file
19
schemars/tests/expected/crate_alias.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Struct",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"bar",
|
||||
"foo"
|
||||
],
|
||||
"properties": {
|
||||
"foo": {
|
||||
"description": "This is a document",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"bar": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue