Skip to content

Commit 9700da8

Browse files
committed
feat: Refactoring
1 parent 159918a commit 9700da8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/openapi/openapi3.schema.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ const buildNullTypeWithOrigins = (
100100
const { options, valueOrigins } = context
101101
const { originsFlag, syntheticTitleFlag } = options
102102

103-
const nullableObject = factory(
103+
const nullTypeObject = factory(
104104
{ [JSON_SCHEMA_PROPERTY_TYPE]: JSON_SCHEMA_NODE_TYPE_NULL },
105105
valueOrigins,
106106
options,
107107
)
108108

109109
const inputOrigins = valueWithoutNullable[originsFlag] as Record<PropertyKey, unknown> | undefined
110-
const nullOrigins = nullableObject[originsFlag] as Record<PropertyKey, unknown> | undefined ?? {}
110+
const nullOrigins = nullTypeObject[originsFlag] as Record<PropertyKey, unknown> | undefined ?? {}
111111

112112
if (inputOrigins && inputOrigins.nullable) {
113113
const getOriginParent = (item: unknown) => ({
@@ -122,7 +122,7 @@ const buildNullTypeWithOrigins = (
122122

123123
const valueTitle = valueWithoutNullable[JSON_SCHEMA_PROPERTY_TITLE]
124124
if (valueTitle) {
125-
nullableObject[JSON_SCHEMA_PROPERTY_TITLE] = valueTitle
125+
nullTypeObject[JSON_SCHEMA_PROPERTY_TITLE] = valueTitle
126126

127127
const titleOrigins = inputOrigins && inputOrigins[JSON_SCHEMA_PROPERTY_TITLE]
128128
if (titleOrigins) {
@@ -131,10 +131,10 @@ const buildNullTypeWithOrigins = (
131131
}
132132

133133
if (syntheticTitleFlag && valueWithoutNullable[syntheticTitleFlag]) {
134-
nullableObject[syntheticTitleFlag] = true
134+
nullTypeObject[syntheticTitleFlag] = true
135135
}
136136

137-
return nullableObject
137+
return nullTypeObject
138138
}
139139

140140
const jsonSchemaOas30to31Adapter: (factory: NativeAnySchemaFactory) => AdapterResolver = (factory) => (value, reference, valueContext) => {

0 commit comments

Comments
 (0)