• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{% macro _check_err() -%}
2if (err !== validator.validationError.NONE)
3    return err;
4{%- endmacro %}
5
6{%- macro _validate_field(field, offset, name) %}
7{%-   if field|is_string_pointer_field %}
8// validate {{name}}
9err = messageValidator.validateStringPointer({{offset}}, {{field|validate_string_params}})
10{{_check_err()}}
11{%-   elif field|is_array_pointer_field %}
12// validate {{name}}
13err = messageValidator.validateArrayPointer({{offset}}, {{field|validate_array_params}});
14{{_check_err()}}
15{%-   elif field|is_struct_pointer_field %}
16// validate {{name}}
17err = messageValidator.validateStructPointer({{offset}}, {{field|validate_struct_params}});
18{{_check_err()}}
19{%-   elif field|is_map_pointer_field %}
20// validate {{name}}
21err = messageValidator.validateMapPointer({{offset}}, {{field|validate_map_params}});
22{{_check_err()}}
23{%-   elif field|is_interface_field %}
24// validate {{name}}
25err = messageValidator.validateInterface({{offset}}, {{field|validate_interface_params}});
26{{_check_err()}}
27{%-   elif field|is_handle_field %}
28// validate {{name}}
29err = messageValidator.validateHandle({{offset}}, {{field|validate_handle_params}})
30{{_check_err()}}
31{%-   endif %}
32{%- endmacro %}
33
34{%- macro validate_struct_field(field, offset, name) %}
35{%-   if field|is_union_field %}
36// validate {{name}}
37err = messageValidator.validateUnion({{offset}}, {{field|validate_union_params}});
38{{_check_err()}}
39{%-   else %}
40{{_validate_field(field, offset, name)}}
41{%-   endif %}
42{%- endmacro %}
43
44{%- macro validate_union_field(field, offset, name) %}
45{%-   if field|is_union_field %}
46// validate {{name}}
47err = messageValidator.validateNestedUnion({{offset}}, {{field|validate_union_params}});
48{{_check_err()}}
49{%-   else %}
50{{_validate_field(field, offset, name)}}
51{%-   endif %}
52{%- endmacro %}
53