diff --git a/assets/assetProp.go b/assets/assetProp.go index 6cd6d3f..65cd1e4 100644 --- a/assets/assetProp.go +++ b/assets/assetProp.go @@ -1,24 +1,26 @@ package assets //AssetProp describes properties of each asset attribute -// The tag is used to reference the prop -// The label is for frontend rendering -// The description is a simple explanation for the specific field -// IsKey defines if the prop is a Primary Key -// Readonly makes impossible to overwrite a property -// The DefaulValue is the assets default state -// DataType defines the asset's type. It can receive custom data types -// Writers is an array of orgs that specify who can write in the asset -// Validate receives a function to validate the asset input type AssetProp struct { - Tag string `json:"tag"` - Label string `json:"label"` + // The tag is used to reference the prop + Tag string `json:"tag"` + + // The label is for frontend rendering + Label string `json:"label"` + + // The description is a simple explanation for the specific field Description string `json:"description"` - IsKey bool `json:"isKey"` + // IsKey defines if the prop is a Primary Key + IsKey bool `json:"isKey"` + + // Tells if the prop is required Required bool `json:"required"` + + // Readonly makes impossible to overwrite a property ReadOnly bool `json:"readOnly"` + // The DefaulValue is the assets default state DefaultValue interface{} `json:"defaultValue,omitempty"` /* DataType can assume the following values: @@ -29,9 +31,14 @@ type AssetProp struct { */ DataType string `json:"dataType"` - // Writers accepts either []string{'org1MSP', 'org2MSP'} and cc-tools will - // check for an exact match or []string{`$org\dMSP`} and cc-tools will + // Writers is an array of orgs that specify who can write in the asset + // and accepts either basic strings for exact matches + // eg. []string{'org1MSP', 'org2MSP'} + // or regular expressions + // eg. []string{`$org\dMSP`} and cc-tools will // check for a match with regular expression `org\dMSP` - Writers []string `json:"writers"` + Writers []string `json:"writers"` + + // Validate receives a function to validate the asset input Validate func(interface{}) error `json:"-"` } diff --git a/assets/assetType.go b/assets/assetType.go index f8e0438..12b47cd 100644 --- a/assets/assetType.go +++ b/assets/assetType.go @@ -3,18 +3,23 @@ package assets import "strings" // AssetType is a list of all asset properties -// The label is for frontend rendering -// The description is a simple explanation for the specific field -// Props receives an array of assetProps, definig the assets properties -// Readers is an array that specifies which organizations can read the asset (used for private data) -// Validates is a function that performs the asset input validation type AssetType struct { - Tag string `json:"tag"` - Label string `json:"label"` + // Tag is how the asset will be referenced + Tag string `json:"tag"` + + // The label is for frontend rendering + Label string `json:"label"` + + // The description is a simple explanation for the specific field Description string `json:"description"` - Props []AssetProp `json:"props"` - Readers []string `json:"readers,omitempty"` + // Props receives an array of assetProps, definig the assets properties + Props []AssetProp `json:"props"` + + // Readers is an array that specifies which organizations can read the asset (used for private data) + Readers []string `json:"readers,omitempty"` + + // Validates is a function that performs the asset input validation Validate func(Asset) error `json:"-"` }