@@ -10,6 +10,7 @@ import {
1010 checkNumericIdentifierExclusion ,
1111 throwNumericIdentifierValidationError ,
1212} from "./shared/utils" ;
13+ import { ERROR_MESSAGES } from "../constants" ;
1314
1415export type TSGenOptions = {
1516 docgen : DocumentationGenerator ;
@@ -276,7 +277,7 @@ export default function (userOptions: TSGenOptions) {
276277 const reason = `Unknown field type: ${ field . data_type } ` ;
277278 skippedFields . push ( { uid : field . uid , path : field . uid , reason } ) ;
278279 logger ?. warn (
279- `Skipped field " ${ field . uid } " with unknown type " ${ field . data_type } ": ${ reason } `
280+ ERROR_MESSAGES . SKIPPED_FIELD_UNKNOWN_TYPE ( field . uid , field . data_type , reason )
280281 ) ;
281282 type = "Record<string, unknown>" ; // Use Record<string, unknown> for balanced type safety
282283 }
@@ -294,7 +295,7 @@ export default function (userOptions: TSGenOptions) {
294295 if ( exclusionCheck . shouldExclude ) {
295296 skippedFields . push ( exclusionCheck . record ! ) ;
296297 logger ?. warn (
297- `Skipped global field reference " ${ field . uid } " to " ${ field . reference_to } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
298+ ERROR_MESSAGES . SKIPPED_GLOBAL_FIELD_REFERENCE ( field . uid , field . reference_to , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
298299 ) ;
299300 return "string" ; // Use string as fallback for global field references
300301 }
@@ -348,7 +349,7 @@ export default function (userOptions: TSGenOptions) {
348349 if ( exclusionCheck . shouldExclude ) {
349350 skippedFields . push ( exclusionCheck . record ! ) ;
350351 logger ?. warn (
351- `Skipped field " ${ field . uid } " at path " ${ fieldPath } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
352+ ERROR_MESSAGES . SKIPPED_FIELD_AT_PATH ( field . uid , fieldPath , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
352353 ) ;
353354 continue ;
354355 }
@@ -411,7 +412,7 @@ export default function (userOptions: TSGenOptions) {
411412 if ( exclusionCheck . shouldExclude ) {
412413 skippedBlocks . push ( exclusionCheck . record ! ) ;
413414 logger ?. warn (
414- `Skipped block " ${ block . uid } " at path " ${ blockPath } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
415+ ERROR_MESSAGES . SKIPPED_BLOCK_AT_PATH ( block . uid , blockPath , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
415416 ) ;
416417 return null ; // Return null to filter out later
417418 }
@@ -513,7 +514,7 @@ export default function (userOptions: TSGenOptions) {
513514 if ( exclusionCheck . shouldExclude ) {
514515 skippedFields . push ( exclusionCheck . record ! ) ;
515516 logger ?. warn (
516- `Skipped global field " ${ field . uid } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
517+ ERROR_MESSAGES . SKIPPED_GLOBAL_FIELD ( field . uid , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
517518 ) ;
518519 return "string" ; // Use string as fallback for global fields
519520 }
@@ -522,7 +523,7 @@ export default function (userOptions: TSGenOptions) {
522523 const reason = "Schema not found for global field" ;
523524 skippedFields . push ( { uid : field . uid , path : field . uid , reason } ) ;
524525 logger ?. warn (
525- `Skipped global field " ${ field . uid } ": ${ reason } . Did you forget to include it?`
526+ ERROR_MESSAGES . SKIPPED_GLOBAL_FIELD_NO_SCHEMA ( field . uid , reason )
526527 ) ;
527528 return "string" ; // Use string as fallback
528529 }
@@ -559,7 +560,7 @@ export default function (userOptions: TSGenOptions) {
559560 references . push ( name_type ( v ) ) ;
560561 } else {
561562 logger ?. warn (
562- `Skipped reference to content type " ${ v } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
563+ ERROR_MESSAGES . SKIPPED_REFERENCE ( v , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
563564 ) ;
564565 }
565566 } ) ;
@@ -569,7 +570,7 @@ export default function (userOptions: TSGenOptions) {
569570 references . push ( name_type ( field . reference_to ) ) ;
570571 } else {
571572 logger ?. warn (
572- `Skipped reference to content type " ${ field . reference_to } ": ${ NUMERIC_IDENTIFIER_EXCLUSION_REASON } `
573+ ERROR_MESSAGES . SKIPPED_REFERENCE ( field . reference_to , NUMERIC_IDENTIFIER_EXCLUSION_REASON )
573574 ) ;
574575 }
575576 }
@@ -603,7 +604,7 @@ export default function (userOptions: TSGenOptions) {
603604 // Log summary table of skipped fields and blocks
604605 if ( logger && ( skippedFields . length > 0 || skippedBlocks . length > 0 ) ) {
605606 logger . info ( "" ) ;
606- logger . info ( "Summary of Skipped Items:" ) ;
607+ logger . info ( ERROR_MESSAGES . SUMMARY_HEADER ) ;
607608
608609 // Create combined table data for all skipped items
609610 const allSkippedItems = [
@@ -636,8 +637,8 @@ export default function (userOptions: TSGenOptions) {
636637
637638 const totalSkipped = skippedFields . length + skippedBlocks . length ;
638639 logger . info ( "" ) ;
639- logger . warn ( `Total skipped items: ${ totalSkipped } ` ) ;
640- logger . success ( " Generation completed successfully with partial schema." ) ;
640+ logger . warn ( ERROR_MESSAGES . TOTAL_SKIPPED_ITEMS ( totalSkipped ) ) ;
641+ logger . success ( ERROR_MESSAGES . GENERATION_COMPLETED_PARTIAL ) ;
641642 }
642643
643644 return {
0 commit comments