1- import type { AbstractType } from '../type/classes/AbstractType ' ;
1+ import type { AbsType } from '../type/classes/AbsType ' ;
22import type { AnyType } from '../type/classes/AnyType' ;
3- import type { ArrayType } from '../type/classes/ArrayType ' ;
4- import type { BinaryType } from '../type/classes/BinaryType ' ;
5- import type { BooleanType } from '../type/classes/BooleanType ' ;
6- import type { ConstType } from '../type/classes/ConstType ' ;
3+ import type { ArrType } from '../type/classes/ArrType ' ;
4+ import type { BinType } from '../type/classes/BinType ' ;
5+ import type { BoolType } from '../type/classes/BoolType ' ;
6+ import type { ConType } from '../type/classes/ConType ' ;
77import type { MapType } from '../type/classes/MapType' ;
8- import type { NumberType } from '../type/classes/NumberType ' ;
9- import type { ObjectType } from '../type/classes/ObjectType ' ;
8+ import type { NumType } from '../type/classes/NumType ' ;
9+ import type { ObjType } from '../type/classes/ObjType ' ;
1010import type { OrType } from '../type/classes/OrType' ;
1111import type { RefType } from '../type/classes/RefType' ;
12- import type { StringType } from '../type/classes/StringType ' ;
13- import type { TupleType } from '../type/classes/TupleType ' ;
12+ import type { StrType } from '../type/classes/StrType ' ;
13+ import type { TupType } from '../type/classes/TupType ' ;
1414import type { TypeExportContext } from '../system/TypeExportContext' ;
1515import type * as schema from '../schema' ;
1616import type {
@@ -30,9 +30,9 @@ import type {
3030
3131/**
3232 * Extracts the base JSON Schema properties that are common to all types.
33- * This replaces the logic from AbstractType .toJsonSchema().
33+ * This replaces the logic from AbsType .toJsonSchema().
3434 */
35- function getBaseJsonSchema ( type : AbstractType < any > , ctx ?: TypeExportContext ) : JsonSchemaGenericKeywords {
35+ function getBaseJsonSchema ( type : AbsType < any > , ctx ?: TypeExportContext ) : JsonSchemaGenericKeywords {
3636 const typeSchema = type . getSchema ( ) ;
3737 const jsonSchema : JsonSchemaGenericKeywords = { } ;
3838
@@ -49,34 +49,34 @@ function getBaseJsonSchema(type: AbstractType<any>, ctx?: TypeExportContext): Js
4949 * Main router function that converts a type to JSON Schema using a switch statement.
5050 * This replaces the individual toJsonSchema() methods on each type class.
5151 */
52- export function typeToJsonSchema ( type : AbstractType < any > , ctx ?: TypeExportContext ) : JsonSchemaNode {
52+ export function typeToJsonSchema ( type : AbsType < any > , ctx ?: TypeExportContext ) : JsonSchemaNode {
5353 const typeName = type . getTypeName ( ) ;
5454
5555 switch ( typeName ) {
5656 case 'any' :
5757 return anyToJsonSchema ( type as AnyType , ctx ) ;
5858 case 'arr' :
59- return arrayToJsonSchema ( type as ArrayType < any > , ctx ) ;
59+ return arrayToJsonSchema ( type as ArrType < any > , ctx ) ;
6060 case 'bin' :
61- return binaryToJsonSchema ( type as BinaryType < any > , ctx ) ;
61+ return binaryToJsonSchema ( type as BinType < any > , ctx ) ;
6262 case 'bool' :
63- return booleanToJsonSchema ( type as BooleanType , ctx ) ;
64- case 'const ' :
65- return constToJsonSchema ( type as ConstType < any > , ctx ) ;
63+ return booleanToJsonSchema ( type as BoolType , ctx ) ;
64+ case 'con ' :
65+ return constToJsonSchema ( type as ConType < any > , ctx ) ;
6666 case 'map' :
6767 return mapToJsonSchema ( type as MapType < any > , ctx ) ;
6868 case 'num' :
69- return numberToJsonSchema ( type as NumberType , ctx ) ;
69+ return numberToJsonSchema ( type as NumType , ctx ) ;
7070 case 'obj' :
71- return objectToJsonSchema ( type as ObjectType < any > , ctx ) ;
71+ return objectToJsonSchema ( type as ObjType < any > , ctx ) ;
7272 case 'or' :
7373 return orToJsonSchema ( type as OrType < any > , ctx ) ;
7474 case 'ref' :
7575 return refToJsonSchema ( type as RefType < any > , ctx ) ;
7676 case 'str' :
77- return stringToJsonSchema ( type as StringType , ctx ) ;
77+ return stringToJsonSchema ( type as StrType , ctx ) ;
7878 case 'tup' :
79- return tupleToJsonSchema ( type as TupleType < any > , ctx ) ;
79+ return tupleToJsonSchema ( type as TupType < any > , ctx ) ;
8080 default :
8181 // Fallback to base implementation for unknown types
8282 return getBaseJsonSchema ( type , ctx ) ;
@@ -97,7 +97,7 @@ function anyToJsonSchema(type: AnyType, ctx?: TypeExportContext): JsonSchemaAny
9797 return result ;
9898}
9999
100- function arrayToJsonSchema ( type : ArrayType < any > , ctx ?: TypeExportContext ) : JsonSchemaArray {
100+ function arrayToJsonSchema ( type : ArrType < any > , ctx ?: TypeExportContext ) : JsonSchemaArray {
101101 const schema = type . getSchema ( ) ;
102102 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
103103 const result : JsonSchemaArray = {
@@ -114,7 +114,7 @@ function arrayToJsonSchema(type: ArrayType<any>, ctx?: TypeExportContext): JsonS
114114 return result ;
115115}
116116
117- function binaryToJsonSchema ( type : BinaryType < any > , ctx ?: TypeExportContext ) : JsonSchemaBinary {
117+ function binaryToJsonSchema ( type : BinType < any > , ctx ?: TypeExportContext ) : JsonSchemaBinary {
118118 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
119119 const result : JsonSchemaBinary = {
120120 type : 'binary' as any ,
@@ -126,7 +126,7 @@ function binaryToJsonSchema(type: BinaryType<any>, ctx?: TypeExportContext): Jso
126126 return result ;
127127}
128128
129- function booleanToJsonSchema ( type : BooleanType , ctx ?: TypeExportContext ) : JsonSchemaBoolean {
129+ function booleanToJsonSchema ( type : BoolType , ctx ?: TypeExportContext ) : JsonSchemaBoolean {
130130 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
131131 const result : JsonSchemaBoolean = {
132132 type : 'boolean' ,
@@ -138,7 +138,7 @@ function booleanToJsonSchema(type: BooleanType, ctx?: TypeExportContext): JsonSc
138138 return result ;
139139}
140140
141- function constToJsonSchema ( type : ConstType < any > , ctx ?: TypeExportContext ) : JsonSchemaNode {
141+ function constToJsonSchema ( type : ConType < any > , ctx ?: TypeExportContext ) : JsonSchemaNode {
142142 const schema = type . getSchema ( ) ;
143143 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
144144 const value = schema . value ;
@@ -204,7 +204,7 @@ function mapToJsonSchema(type: MapType<any>, ctx?: TypeExportContext): JsonSchem
204204 const result : JsonSchemaObject = {
205205 type : 'object' ,
206206 patternProperties : {
207- '.*' : typeToJsonSchema ( ( type as any ) . type , ctx ) ,
207+ '.*' : typeToJsonSchema ( ( type as any ) . valueType , ctx ) ,
208208 } ,
209209 } ;
210210
@@ -214,7 +214,7 @@ function mapToJsonSchema(type: MapType<any>, ctx?: TypeExportContext): JsonSchem
214214 return result ;
215215}
216216
217- function numberToJsonSchema ( type : NumberType , ctx ?: TypeExportContext ) : JsonSchemaNumber {
217+ function numberToJsonSchema ( type : NumType , ctx ?: TypeExportContext ) : JsonSchemaNumber {
218218 const schema = type . getSchema ( ) ;
219219 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
220220 const result : JsonSchemaNumber = {
@@ -238,7 +238,7 @@ function numberToJsonSchema(type: NumberType, ctx?: TypeExportContext): JsonSche
238238 return result ;
239239}
240240
241- function objectToJsonSchema ( type : ObjectType < any > , ctx ?: TypeExportContext ) : JsonSchemaObject {
241+ function objectToJsonSchema ( type : ObjType < any > , ctx ?: TypeExportContext ) : JsonSchemaObject {
242242 const schema = type . getSchema ( ) ;
243243 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
244244 const result : JsonSchemaObject = {
@@ -294,7 +294,7 @@ function refToJsonSchema(type: RefType<any>, ctx?: TypeExportContext): JsonSchem
294294 return result ;
295295}
296296
297- function stringToJsonSchema ( type : StringType , ctx ?: TypeExportContext ) : JsonSchemaString {
297+ function stringToJsonSchema ( type : StrType , ctx ?: TypeExportContext ) : JsonSchemaString {
298298 const schema = type . getSchema ( ) ;
299299 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
300300 const result : JsonSchemaString = {
@@ -323,7 +323,7 @@ function stringToJsonSchema(type: StringType, ctx?: TypeExportContext): JsonSche
323323 return result ;
324324}
325325
326- function tupleToJsonSchema ( type : TupleType < any > , ctx ?: TypeExportContext ) : JsonSchemaArray {
326+ function tupleToJsonSchema ( type : TupType < any > , ctx ?: TypeExportContext ) : JsonSchemaArray {
327327 const baseSchema = getBaseJsonSchema ( type , ctx ) ;
328328 const types = ( type as any ) . types ;
329329 const result : JsonSchemaArray = {
0 commit comments