From 967efc630fada8b7b919baf7246b99c36fd08090 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 09:58:55 +0200 Subject: [PATCH] docs(depinject): explain need `appmodule.Module` interface (backport #15880) (#15881) Co-authored-by: Julien Robert --- docs/docs/building-modules/15-depinject.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/docs/building-modules/15-depinject.md b/docs/docs/building-modules/15-depinject.md index 66dafca863da..96dd5dc398c7 100644 --- a/docs/docs/building-modules/15-depinject.md +++ b/docs/docs/building-modules/15-depinject.md @@ -79,7 +79,13 @@ All methods, structs and their fields must be public for `depinject`. https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L199-L204 ``` -2. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies): +2. Ensure that the module implements the `appmodule.AppModule` interface: + + ```go reference + https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/x/group/module/module.go#L58-L64 + ``` + +3. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies): * `depinject` provides the right dependencies to the module. * `depinject` also checks that all dependencies are provided. @@ -91,14 +97,14 @@ All methods, structs and their fields must be public for `depinject`. https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L206-L216 ``` -3. Define the module outputs with a public struct that inherits `depinject.Out`: +4. Define the module outputs with a public struct that inherits `depinject.Out`: The module outputs are the dependencies that the module provides to other modules. It is usually the module itself and its keeper. ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L218-L223 ``` -4. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs. +5. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs. ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L225-L235