Natspec: Output "type" and "version" in documenation

This commit is contained in:
Mathias Baumann
2020-06-15 14:53:34 +02:00
parent 08b7d007da
commit d54e7f50ed
5 changed files with 16 additions and 2 deletions
+6
View File
@@ -37,6 +37,9 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef)
Json::Value doc;
Json::Value methods(Json::objectValue);
doc["version"] = Json::Value(c_natspecVersion);
doc["kind"] = Json::Value("user");
auto constructorDefinition(_contractDef.constructor());
if (constructorDefinition)
{
@@ -87,6 +90,9 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef)
Json::Value doc;
Json::Value methods(Json::objectValue);
doc["version"] = Json::Value(c_natspecVersion);
doc["kind"] = Json::Value("dev");
auto author = extractDoc(_contractDef.annotation().docTags, "author");
if (!author.empty())
doc["author"] = author;
+2
View File
@@ -40,6 +40,8 @@ struct DocTag;
class Natspec
{
public:
static unsigned int constexpr c_natspecVersion = 1;
/// Get the User documentation of the contract
/// @param _contractDef The contract definition
/// @return A JSON representation of the contract's user documentation