code: func (t Types) validate() error {
  	for typeKey, typeArr := range t {
  		for _, typeObj := range typeArr {
  			if typeKey == typeObj.Type {
  				return fmt.Errorf("type '%s' cannot reference itself", typeObj.Type)
  			}
  			if typeObj.isReferenceType() {
  				if _, exist := t[typeObj.Type]; !exist {
  					return fmt.Errorf("reference type '%s' is undefined", typeObj.Type)
  				}
  				if !typedDataReferenceTypeRegexp.MatchString(typeObj.Type) {
  					return fmt.Errorf("unknown reference type '%s", typeObj.Type)
  				}
  			} else if !isPrimitiveTypeValid(typeObj.Type) {
  				return fmt.Errorf("unknown type '%s'", typeObj.Type)
  			}
  		}
  	}
  	return nil
  }
docs: // Validate checks if the types object is conformant to the specs