mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
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:
@@ -0,0 +1,16 @@
|
||||
#[frame_support::pallet]
|
||||
// Must receive a string literal pointing to a path
|
||||
#[pallet_doc(X)]
|
||||
mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config
|
||||
where
|
||||
<Self as frame_system::Config>::Index: From<u128>,
|
||||
{
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(core::marker::PhantomData<T>);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc(PATH)`
|
||||
--> tests/pallet_ui/pallet_doc_arg_non_path.rs:3:1
|
||||
|
|
||||
3 | #[pallet_doc(X)]
|
||||
| ^
|
||||
@@ -0,0 +1,16 @@
|
||||
#[frame_support::pallet]
|
||||
// Expected one argument for the doc path.
|
||||
#[pallet_doc]
|
||||
mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config
|
||||
where
|
||||
<Self as frame_system::Config>::Index: From<u128>,
|
||||
{
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(core::marker::PhantomData<T>);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: The `pallet_doc` attribute must receive arguments as a list. Supported format: `pallet_doc(PATH)`
|
||||
--> tests/pallet_ui/pallet_doc_empty.rs:3:1
|
||||
|
|
||||
3 | #[pallet_doc]
|
||||
| ^
|
||||
@@ -0,0 +1,16 @@
|
||||
#[frame_support::pallet]
|
||||
// Argument expected as list, not named value.
|
||||
#[pallet_doc = "invalid"]
|
||||
mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config
|
||||
where
|
||||
<Self as frame_system::Config>::Index: From<u128>,
|
||||
{
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(core::marker::PhantomData<T>);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: The `pallet_doc` attribute must receive arguments as a list. Supported format: `pallet_doc(PATH)`
|
||||
--> tests/pallet_ui/pallet_doc_invalid_arg.rs:3:1
|
||||
|
|
||||
3 | #[pallet_doc = "invalid"]
|
||||
| ^
|
||||
@@ -0,0 +1,16 @@
|
||||
#[frame_support::pallet]
|
||||
// Supports only one argument.
|
||||
#[pallet_doc("A", "B")]
|
||||
mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config
|
||||
where
|
||||
<Self as frame_system::Config>::Index: From<u128>,
|
||||
{
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(core::marker::PhantomData<T>);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: The `pallet_doc` attribute must receive only one argument. Supported format: `pallet_doc(PATH)`
|
||||
--> tests/pallet_ui/pallet_doc_multiple_args.rs:3:1
|
||||
|
|
||||
3 | #[pallet_doc("A", "B")]
|
||||
| ^
|
||||
Reference in New Issue
Block a user