emitAnnotation()

in lib/generator.js [571:597]


  emitAnnotation(node, attrList, level) {
    const realName = getAttr(node, 'name') || _name(node.fieldName);
    this.emit(`[NameInMap("${realName}")]\n`, level);
    this.emit('[Validation(Required=', level);
    node.required ? this.emit('true') : this.emit('false');

    for (let i = 0; i < node.attrs.length; i++) {
      const attrValueType = attrList[node.attrs[i].attrName.lexeme];
      if (attrValueType) {
        this.emit(', ');
        var attrName = _upperFirst(node.attrs[i].attrName.lexeme);
        attrName = attrName.split('-').join('');
        if (attrValueType === 'string') {
          this.emit(`${attrName}="${node.attrs[i].attrValue[attrValueType]}"`);
        } else {
          this.emit(`${attrName}=${node.attrs[i].attrValue[attrValueType]}`);
        }
      }
    }

    this.emit(')]\n');

    const deprecated = getAttr(node, 'deprecated');
    if (deprecated === 'true') {
      this.emit(`[Obsolete]\n`, level);
    }
  }