I believe it pays off to have your .did file committed to the repository, documented, and curated manually. This is the face of your canister, the main thing that people who integrate with your canister will care about. It’s a lot like a header file for a C/C++ library or a module interface file in OCaml.
Being able to generate a .did file automatically is still very useful:
- You can use it get the first version of the .did file that you can edit by hand afterwards.
- You can use it to generate the actual interface of your canister and pipe it to
didc subtype
as a precommit hook to make sure that the manually curated.did
file is not obsolete.
IC governance canister adds a main
function that outputs the .did
file when compiled in native mode:
The generated governance.did
file is also committed to the repository: ic/governance.did at 40ab84f4fcb9e6c2441e91a59cfaa5acf84fe38d · dfinity/ic · GitHub