Skip to content
Snippets Groups Projects
Unverified Commit 4d99c96d authored by Jess's avatar Jess Committed by GitHub
Browse files

Merge pull request #183 from abiogenesis-now/jyao/parse-short-description-for-prototypes

Parse short description for prototypes
parents 6ee8849d 4233bcc5
No related branches found
No related tags found
No related merge requests found
......@@ -18,11 +18,12 @@ import (
//
const (
apiVersionTag = "@apiVersion"
nameTag = "@name"
descriptionTag = "@description"
paramTag = "@param"
optParamTag = "@optionalParam"
apiVersionTag = "@apiVersion"
nameTag = "@name"
descriptionTag = "@description"
shortDescriptionTag = "@shortDescription"
paramTag = "@param"
optParamTag = "@optionalParam"
)
func FromJsonnet(data string) (*SpecificationSchema, error) {
......@@ -97,7 +98,7 @@ func FromJsonnet(data string) (*SpecificationSchema, error) {
openText = bytes.Buffer{}
openText.WriteString(strings.TrimSpace(split[1]))
switch split[0] {
case apiVersionTag, nameTag, descriptionTag, paramTag, optParamTag: // Do nothing.
case apiVersionTag, nameTag, descriptionTag, shortDescriptionTag, paramTag, optParamTag: // Do nothing.
default:
return nil, fmt.Errorf(`Line in prototype heading comment is formatted incorrectly; '%s' is not
recognized as a tag. Only tags can begin lines, and text that is wrapped must
......@@ -186,6 +187,11 @@ func (s *SpecificationSchema) addField(tag, text string) error {
return fmt.Errorf("Prototype heading comment has two '@description' fields")
}
s.Template.Description = text
case shortDescriptionTag:
if s.Template.ShortDescription != "" {
return fmt.Errorf("Prototype heading comment has two '@shortDescription' fields")
}
s.Template.ShortDescription = text
case paramTag:
// NOTE: There is usually more than one `@param`, so we don't
// check length here.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment