Metadata V15: Expose pallet documentation (#13452)

* frame/proc: Helpers to parse pallet documentation attributes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/proc: Expand pallet with runtime metadata documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/dispatch: Implement doc function getter for dispatch

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Check exposed runtime metadata documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Add UI tests for `pallet_doc` attribute

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/proc: Document pallet_doc attribute

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Use `derive_syn_parse`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* frame/support: Improve documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This commit is contained in:
Alexandru Vasile
2023-03-13 21:02:53 +02:00
committed by GitHub
parent efd5d98e10
commit 4cbf855ecd
13 changed files with 396 additions and 0 deletions
+24
View File
@@ -2948,6 +2948,10 @@ macro_rules! decl_module {
{ $( $other_where_bounds )* }
$( $error_type )*
}
$crate::__impl_docs_metadata! {
$mod_type<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?>
{ $( $other_where_bounds )* }
}
$crate::__impl_module_constants_metadata ! {
$mod_type<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?>
{ $( $other_where_bounds )* }
@@ -3018,6 +3022,26 @@ macro_rules! __impl_error_metadata {
};
}
/// Implement metadata for pallet documentation.
#[macro_export]
#[doc(hidden)]
macro_rules! __impl_docs_metadata {
(
$mod_type:ident<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path)?>
{ $( $other_where_bounds:tt )* }
) => {
impl<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?> $mod_type<$trait_instance $(, $instance)?>
where $( $other_where_bounds )*
{
#[doc(hidden)]
#[allow(dead_code)]
pub fn pallet_documentation_metadata() -> $crate::sp_std::vec::Vec<&'static str> {
$crate::sp_std::vec![]
}
}
};
}
/// Implement metadata for module constants.
#[macro_export]
#[doc(hidden)]