|
1 | | -functionsDir: ../functions |
2 | | -functions: |
3 | | - - aep-142-time-field-type |
4 | | - |
5 | | -rules: |
6 | | - aep-142-time-field-type: |
7 | | - description: 'Fields with time-related suffixes should use appropriate types and formats.' |
8 | | - message: '{{error}}' |
9 | | - severity: warn |
10 | | - formats: ['oas2', 'oas3'] |
11 | | - given: '$..properties[?(@property.match(/_(time|times|date|seconds|millis|micros|nanos)$/))]' |
12 | | - then: |
13 | | - function: aep-142-time-field-type |
14 | | - |
15 | | - aep-142-time-field-names: |
16 | | - description: 'Timestamp fields should use imperative mood with _time suffix, not past tense.' |
17 | | - message: 'Use imperative mood with "_time" suffix (e.g., "{{property}}_time") instead of past tense.' |
18 | | - severity: warn |
19 | | - formats: ['oas2', 'oas3'] |
20 | | - given: '$..[?(@.type == "string" && @.format == "date-time")]~' |
21 | | - then: |
22 | | - field: '@key' |
23 | | - function: pattern |
24 | | - functionOptions: |
25 | | - notMatch: '(created|creation|updated|modified|expired|purged|deleted|published|started|ended|completed)' |
26 | | - |
27 | | - aep-142-time-field-suffix: |
28 | | - description: 'Timestamp fields must end in _time suffix.' |
29 | | - message: 'Timestamp field "{{property}}" should end with "_time" suffix.' |
30 | | - severity: warn |
31 | | - formats: ['oas2', 'oas3'] |
32 | | - given: '$..[?(@.type == "string" && @.format == "date-time")]~' |
33 | | - then: |
34 | | - field: '@key' |
35 | | - function: pattern |
36 | | - functionOptions: |
37 | | - match: '_time$' |
| 1 | +functionsDir: ../functions |
| 2 | +functions: |
| 3 | + - aep-142-time-field-type |
| 4 | + |
| 5 | +rules: |
| 6 | + aep-142-time-field-type: |
| 7 | + description: 'Fields with time-related suffixes should use appropriate types and formats.' |
| 8 | + message: '{{error}}' |
| 9 | + severity: warn |
| 10 | + formats: ['oas2', 'oas3'] |
| 11 | + given: '$..properties[?(@property.match(/_(time|times|date|seconds|millis|micros|nanos)$/))]' |
| 12 | + then: |
| 13 | + function: aep-142-time-field-type |
| 14 | + |
| 15 | + aep-142-time-field-names: |
| 16 | + description: 'Timestamp fields should use imperative mood with _time suffix, not past tense.' |
| 17 | + message: 'Use imperative mood with "_time" suffix (e.g., "{{property}}_time") instead of past tense.' |
| 18 | + severity: warn |
| 19 | + formats: ['oas2', 'oas3'] |
| 20 | + given: '$..[?(@.type == "string" && @.format == "date-time")]~' |
| 21 | + then: |
| 22 | + field: '@key' |
| 23 | + function: pattern |
| 24 | + functionOptions: |
| 25 | + notMatch: '(created|creation|updated|modified|expired|purged|deleted|published|started|ended|completed)' |
| 26 | + |
| 27 | + aep-142-time-field-suffix: |
| 28 | + description: 'Timestamp fields must end in _time suffix.' |
| 29 | + message: 'Timestamp field "{{property}}" should end with "_time" suffix.' |
| 30 | + severity: warn |
| 31 | + formats: ['oas2', 'oas3'] |
| 32 | + given: '$..[?(@.type == "string" && @.format == "date-time")]~' |
| 33 | + then: |
| 34 | + field: '@key' |
| 35 | + function: pattern |
| 36 | + functionOptions: |
| 37 | + match: '_time$' |
0 commit comments