@kubb/ast 5.0.0-alpha.17 → 5.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -213
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{visitor-BFn3X90U.d.ts → visitor-DCQyoFvH.d.ts} +5 -3
- package/package.json +1 -1
- package/src/nodes/response.ts +1 -1
- package/src/nodes/schema.ts +3 -1
- package/src/printers/printer.ts +2 -2
- package/src/resolvers.ts +6 -6
- package/src/transformers.ts +1 -1
package/src/printers/printer.ts
CHANGED
|
@@ -184,11 +184,11 @@ export function createPrinterFactory<TNode, TKey extends string, TNodeByKey exte
|
|
|
184
184
|
options: resolvedOptions,
|
|
185
185
|
print: (node: TNode): T['output'] | null | undefined => {
|
|
186
186
|
const key = getKey(node)
|
|
187
|
-
if (key === undefined) return
|
|
187
|
+
if (key === undefined) return null
|
|
188
188
|
|
|
189
189
|
const handler = nodes[key]
|
|
190
190
|
|
|
191
|
-
if (!handler) return
|
|
191
|
+
if (!handler) return null
|
|
192
192
|
|
|
193
193
|
return (handler as (this: typeof context, node: TNode) => T['output'] | null | undefined).call(context, node)
|
|
194
194
|
},
|
package/src/resolvers.ts
CHANGED
|
@@ -4,16 +4,16 @@ import type { SchemaNode } from './nodes/schema.ts'
|
|
|
4
4
|
import { extractRefName } from './refs.ts'
|
|
5
5
|
import { collect } from './visitor.ts'
|
|
6
6
|
|
|
7
|
-
export function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string |
|
|
8
|
-
if (!mapping || !ref) return
|
|
9
|
-
return Object.entries(mapping).find(([, value]) => value === ref)?.[0]
|
|
7
|
+
export function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string | null {
|
|
8
|
+
if (!mapping || !ref) return null
|
|
9
|
+
return Object.entries(mapping).find(([, value]) => value === ref)?.[0] ?? null
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function childName(parentName: string | undefined, propName: string): string |
|
|
13
|
-
return parentName ? pascalCase([parentName, propName].join(' ')) :
|
|
12
|
+
export function childName(parentName: string | null | undefined, propName: string): string | null {
|
|
13
|
+
return parentName ? pascalCase([parentName, propName].join(' ')) : null
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function enumPropName(parentName: string | undefined, propName: string, enumSuffix: string): string {
|
|
16
|
+
export function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {
|
|
17
17
|
return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))
|
|
18
18
|
}
|
|
19
19
|
|
package/src/transformers.ts
CHANGED
|
@@ -144,7 +144,7 @@ export function simplifyUnion(members: Array<SchemaNode>): Array<SchemaNode> {
|
|
|
144
144
|
})
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export function setEnumName(propNode: SchemaNode, parentName: string | undefined, propName: string, enumSuffix: string): SchemaNode {
|
|
147
|
+
export function setEnumName(propNode: SchemaNode, parentName: string | null | undefined, propName: string, enumSuffix: string): SchemaNode {
|
|
148
148
|
const enumNode = narrowSchema(propNode, 'enum')
|
|
149
149
|
|
|
150
150
|
if (enumNode?.primitive === 'boolean') {
|