Move private crate exports into _private
module
This commit is contained in:
parent
441249a53b
commit
9bba81892f
6 changed files with 34 additions and 37 deletions
|
@ -177,17 +177,17 @@ impl CommonAttrs {
|
|||
if !self.examples.is_empty() {
|
||||
let examples = self.examples.iter().map(|eg| {
|
||||
quote! {
|
||||
schemars::_serde_json::value::to_value(#eg())
|
||||
schemars::_private::serde_json::value::to_value(#eg())
|
||||
}
|
||||
});
|
||||
mutators.push(quote! {
|
||||
schemars::_private::insert_metadata_property(&mut #SCHEMA, "examples", schemars::_serde_json::Value::Array([#(#examples),*].into_iter().flatten().collect()));
|
||||
schemars::_private::insert_metadata_property(&mut #SCHEMA, "examples", schemars::_private::serde_json::Value::Array([#(#examples),*].into_iter().flatten().collect()));
|
||||
});
|
||||
}
|
||||
|
||||
for (k, v) in &self.extensions {
|
||||
mutators.push(quote! {
|
||||
schemars::_private::insert_metadata_property(&mut #SCHEMA, #k, schemars::_serde_json::json!(#v));
|
||||
schemars::_private::insert_metadata_property(&mut #SCHEMA, #k, schemars::_private::serde_json::json!(#v));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -62,11 +62,11 @@ fn derive_json_schema(mut input: syn::DeriveInput, repr: bool) -> syn::Result<To
|
|||
<#ty as schemars::JsonSchema>::always_inline_schema()
|
||||
}
|
||||
|
||||
fn schema_name() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
fn schema_name() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
<#ty as schemars::JsonSchema>::schema_name()
|
||||
}
|
||||
|
||||
fn schema_id() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
fn schema_id() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
<#ty as schemars::JsonSchema>::schema_id()
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,10 @@ fn derive_json_schema(mut input: syn::DeriveInput, repr: bool) -> syn::Result<To
|
|||
{
|
||||
(
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Borrowed(#schema_base_name)
|
||||
schemars::_private::alloc::borrow::Cow::Borrowed(#schema_base_name)
|
||||
},
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Borrowed(::core::concat!(
|
||||
schemars::_private::alloc::borrow::Cow::Borrowed(::core::concat!(
|
||||
::core::module_path!(),
|
||||
"::",
|
||||
#schema_base_name
|
||||
|
@ -123,13 +123,13 @@ fn derive_json_schema(mut input: syn::DeriveInput, repr: bool) -> syn::Result<To
|
|||
}
|
||||
(
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Owned(
|
||||
schemars::_alloc::format!(#schema_name_fmt #(,#type_params=#type_params::schema_name())* #(,#const_params=#const_params)*)
|
||||
schemars::_private::alloc::borrow::Cow::Owned(
|
||||
schemars::_private::alloc::format!(#schema_name_fmt #(,#type_params=#type_params::schema_name())* #(,#const_params=#const_params)*)
|
||||
)
|
||||
},
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Owned(
|
||||
schemars::_alloc::format!(
|
||||
schemars::_private::alloc::borrow::Cow::Owned(
|
||||
schemars::_private::alloc::format!(
|
||||
::core::concat!(
|
||||
::core::module_path!(),
|
||||
"::",
|
||||
|
@ -147,13 +147,13 @@ fn derive_json_schema(mut input: syn::DeriveInput, repr: bool) -> syn::Result<To
|
|||
schema_name_fmt.push_str(&"_and_{}".repeat(params.len() - 1));
|
||||
(
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Owned(
|
||||
schemars::_alloc::format!(#schema_name_fmt #(,#type_params::schema_name())* #(,#const_params)*)
|
||||
schemars::_private::alloc::borrow::Cow::Owned(
|
||||
schemars::_private::alloc::format!(#schema_name_fmt #(,#type_params::schema_name())* #(,#const_params)*)
|
||||
)
|
||||
},
|
||||
quote! {
|
||||
schemars::_alloc::borrow::Cow::Owned(
|
||||
schemars::_alloc::format!(
|
||||
schemars::_private::alloc::borrow::Cow::Owned(
|
||||
schemars::_private::alloc::format!(
|
||||
::core::concat!(
|
||||
::core::module_path!(),
|
||||
"::",
|
||||
|
@ -180,11 +180,11 @@ fn derive_json_schema(mut input: syn::DeriveInput, repr: bool) -> syn::Result<To
|
|||
#[automatically_derived]
|
||||
#[allow(unused_braces)]
|
||||
impl #impl_generics schemars::JsonSchema for #type_name #ty_generics #where_clause {
|
||||
fn schema_name() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
fn schema_name() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
#schema_name
|
||||
}
|
||||
|
||||
fn schema_id() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
fn schema_id() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
#schema_id
|
||||
}
|
||||
|
||||
|
|
|
@ -93,12 +93,12 @@ pub fn expr_for_repr(cont: &Container) -> Result<SchemaExpr, syn::Error> {
|
|||
let variant_idents = variants.iter().map(|v| &v.ident);
|
||||
|
||||
let mut schema_expr = SchemaExpr::from(quote!({
|
||||
let mut map = schemars::_serde_json::Map::new();
|
||||
let mut map = schemars::_private::serde_json::Map::new();
|
||||
map.insert("type".into(), "integer".into());
|
||||
map.insert(
|
||||
"enum".into(),
|
||||
schemars::_serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_alloc::vec::Vec::new();
|
||||
schemars::_private::serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_private::alloc::vec::Vec::new();
|
||||
#(enum_values.push((#enum_ident::#variant_idents as #repr_type).into());)*
|
||||
enum_values
|
||||
}),
|
||||
|
@ -157,12 +157,12 @@ fn type_for_schema(with_attr: &WithAttr) -> (syn::Type, Option<TokenStream>) {
|
|||
true
|
||||
}
|
||||
|
||||
fn schema_name() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
schemars::_alloc::borrow::Cow::Borrowed(#fn_name)
|
||||
fn schema_name() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
schemars::_private::alloc::borrow::Cow::Borrowed(#fn_name)
|
||||
}
|
||||
|
||||
fn schema_id() -> schemars::_alloc::borrow::Cow<'static, str> {
|
||||
schemars::_alloc::borrow::Cow::Borrowed(::core::concat!(
|
||||
fn schema_id() -> schemars::_private::alloc::borrow::Cow<'static, str> {
|
||||
schemars::_private::alloc::borrow::Cow::Borrowed(::core::concat!(
|
||||
"_SchemarsSchemaWithFunction/",
|
||||
::core::module_path!(),
|
||||
"/",
|
||||
|
@ -213,12 +213,12 @@ fn expr_for_external_tagged_enum<'a>(
|
|||
.partition(|v| v.is_unit() && v.attrs.is_default());
|
||||
let unit_names = unit_variants.iter().map(|v| v.name());
|
||||
let unit_schema = SchemaExpr::from(quote!({
|
||||
let mut map = schemars::_serde_json::Map::new();
|
||||
let mut map = schemars::_private::serde_json::Map::new();
|
||||
map.insert("type".into(), "string".into());
|
||||
map.insert(
|
||||
"enum".into(),
|
||||
schemars::_serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_alloc::vec::Vec::new();
|
||||
schemars::_private::serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_private::alloc::vec::Vec::new();
|
||||
#(enum_values.push((#unit_names).into());)*
|
||||
enum_values
|
||||
}),
|
||||
|
@ -378,11 +378,11 @@ fn expr_for_adjacent_tagged_enum<'a>(
|
|||
fn variant_subschemas(unique: bool, schemas: Vec<SchemaExpr>) -> SchemaExpr {
|
||||
let keyword = if unique { "oneOf" } else { "anyOf" };
|
||||
quote!({
|
||||
let mut map = schemars::_serde_json::Map::new();
|
||||
let mut map = schemars::_private::serde_json::Map::new();
|
||||
map.insert(
|
||||
#keyword.into(),
|
||||
schemars::_serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_alloc::vec::Vec::new();
|
||||
schemars::_private::serde_json::Value::Array({
|
||||
let mut enum_values = schemars::_private::alloc::vec::Vec::new();
|
||||
#(enum_values.push(#schemas.to_value());)*
|
||||
enum_values
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue