| 138 | } |
| 139 | |
| 140 | export function getValidationTip(context: TipContext): ValidationTip | null { |
| 141 | const matcher = TIP_MATCHERS.find(m => m.matches(context)) |
| 142 | |
| 143 | if (!matcher) return null |
| 144 | |
| 145 | const tip: ValidationTip = { ...matcher.tip } |
| 146 | |
| 147 | if ( |
| 148 | context.code === 'invalid_value' && |
| 149 | context.enumValues && |
| 150 | !tip.suggestion |
| 151 | ) { |
| 152 | tip.suggestion = `Valid values: ${context.enumValues.map(v => `"${v}"`).join(', ')}` |
| 153 | } |
| 154 | |
| 155 | // Add documentation link based on path prefix |
| 156 | if (!tip.docLink && context.path) { |
| 157 | const pathPrefix = context.path.split('.')[0] |
| 158 | if (pathPrefix) { |
| 159 | tip.docLink = PATH_DOC_LINKS[pathPrefix] |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | return tip |
| 164 | } |
| 165 | |