11import { DefinePlugin } from "@hey-api/openapi-ts" ;
2+ import type { IR } from '@hey-api/openapi-ts' ;
3+ import type { Schema } from 'json-schema-faker' ;
24
35export interface Config {
46 /**
@@ -20,3 +22,72 @@ export interface Config {
2022}
2123
2224export type BuildersPlugin = DefinePlugin < Config >
25+
26+ // Schema-related types moved from utils.ts
27+ export interface BuilderOptions {
28+ useDefault ?: boolean ;
29+ useExamples ?: boolean ;
30+ alwaysIncludeOptionals ?: boolean ;
31+ optionalsProbability ?: number | false ;
32+ omitNulls ?: boolean ;
33+ }
34+
35+ export interface GeneratedSchemaMeta {
36+ typeName : string ;
37+ constName : string ;
38+ isEnum : boolean ;
39+ schema : Schema ;
40+ isObject : boolean ;
41+ }
42+
43+ export interface EnumSchemaObject {
44+ enum ?: JsonValue [ ] ;
45+ type ?: string | 'enum' ;
46+ items ?: EnumItem [ ] | IR . SchemaObject | IR . SchemaObject [ ] ;
47+ nullable ?: boolean ;
48+ $ref ?: string ;
49+ properties ?: Record < string , IR . SchemaObject > ;
50+ required ?: string [ ] ;
51+ additionalProperties ?: boolean | IR . SchemaObject ;
52+ allOf ?: IR . SchemaObject [ ] ;
53+ anyOf ?: IR . SchemaObject [ ] ;
54+ oneOf ?: IR . SchemaObject [ ] ;
55+ [ key : string ] : unknown ;
56+ }
57+
58+ export interface EnumItem {
59+ const : JsonValue ;
60+ description ?: string ;
61+ }
62+
63+ export type JsonValue = string | number | boolean | null | JsonValue [ ] | { [ key : string ] : JsonValue } ;
64+
65+ export interface ExtendedSchema {
66+ type ?: 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer' | Array < 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer' > ;
67+ properties ?: Record < string , Schema > ;
68+ required ?: string [ ] ;
69+ additionalProperties ?: boolean | Schema ;
70+ items ?: Schema | Schema [ ] ;
71+ allOf ?: Schema [ ] ;
72+ anyOf ?: Schema [ ] ;
73+ oneOf ?: Schema [ ] ;
74+ enum ?: JsonValue [ ] ;
75+ nullable ?: boolean ;
76+ [ key : string ] : unknown ;
77+ }
78+
79+ export interface NormalizedSchemaNode {
80+ type ?: 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer' | 'enum' | Array < 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer' > ;
81+ items ?: NormalizedSchemaNode | NormalizedSchemaNode [ ] ;
82+ properties ?: Record < string , NormalizedSchemaNode > ;
83+ additionalProperties ?: boolean | NormalizedSchemaNode ;
84+ allOf ?: NormalizedSchemaNode [ ] ;
85+ anyOf ?: NormalizedSchemaNode [ ] ;
86+ oneOf ?: NormalizedSchemaNode [ ] ;
87+ enum ?: JsonValue [ ] ;
88+ logicalOperator ?: string ;
89+ const ?: JsonValue ;
90+ [ key : string ] : unknown ;
91+ }
92+
93+ export type BuildersHandler = BuildersPlugin [ 'Handler' ] ;
0 commit comments