Schemas
TYPE
@skmtc/core 0.63.4TypeSystemValue
Union type representing all possible type system values in the SKMTC code generation system.
The TypeSystemValue represents the normalized intermediate representation used by SKMTC to convert OpenAPI schemas into target language types. This type system abstracts away OpenAPI-specific details and provides a consistent interface for generating code in different target languages and frameworks.
Type Categories
- Primitive Types:
string,number,integer,boolean,null - Complex Types:
array,object,union,intersection - Special Types:
void,never,unknown,custom - Reference Types:
reffor schema references
Signature
import type { TypeSystemValue } from '@skmtc/core'
type TypeSystemValue =
| TypeSystemArray
| TypeSystemObject
| TypeSystemUnion
| TypeSystemIntersection
| TypeSystemString
| TypeSystemNumber
| TypeSystemInteger
| TypeSystemBoolean
| TypeSystemUnknown
| TypeSystemVoid
| TypeSystemNever
| TypeSystemRef
| TypeSystemNull
| TypeSystemCustomExamples
Discriminated union usage
import { TypeSystemValue } from '@skmtc/core';
function processType(type: TypeSystemValue): string {
switch (type.type) {
case 'string':
return `string${type.modifiers.optional ? '?' : ''}`;
case 'array':
return `${processType(type.items)}[]`;
case 'object':
return 'object';
case 'ref':
return type.name;
default:
return type.type;
}
}In generator contexts
class TypeScriptGenerator {
generateType(typeValue: TypeSystemValue): string {
if (typeValue.type === 'union') {
return typeValue.members
.map(member => this.generateType(member))
.join(' | ');
}
if (typeValue.type === 'array') {
return `${this.generateType(typeValue.items)}[]`;
}
// Handle other types...
return typeValue.type;
}
}