Skip to content

Commit bf1a50b

Browse files
committed
chore: remove console.logs and add function return types
1 parent a890374 commit bf1a50b

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/utils/get-flattened-schema.ts

+4-15
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ const recursivelyFormatNestedObjects = (
55
schema: SingleReponseObj['schema'],
66
rows: FlattenedSchemaPropertyItem[] = [],
77
iteration = 0,
8-
previousPropertyPrefix = '',
9-
fromArray?: boolean
10-
) => {
8+
previousPropertyPrefix = ''
9+
): FlattenedSchemaPropertyItem[] => {
1110
console.log('iteration: ', iteration)
1211
console.table(rows)
1312
console.log('schema', schema)
1413
const isInitialIteration = iteration === 0
1514
const conditionalPropertyPrefix = isInitialIteration ? '' : '.'
1615
if (schema.type === 'array') {
17-
console.log('schema.type detected as: ' + schema.type)
18-
// console.log('schema', schema)
1916
const row: FlattenedSchemaPropertyItem = {
2017
property: `${previousPropertyPrefix}${conditionalPropertyPrefix}[]`,
2118
type: schema.type ?? '',
@@ -27,27 +24,20 @@ const recursivelyFormatNestedObjects = (
2724
rows.push(row)
2825

2926
if (schema.items.properties) {
30-
console.log('schema.items.properties detected as: ' + schema.items.type)
3127
recursivelyFormatNestedObjects(
3228
schema.items,
3329
rows,
3430
iteration + 1,
35-
row.property,
36-
true
31+
row.property
3732
)
3833
} else {
3934
return rows
4035
}
4136
} else {
42-
console.log('schema.type detected as non-array: ' + schema.type)
43-
44-
// console.log('rows', rows)
45-
// console.log('--schema', schema)
4637
if (schema.properties) {
4738
for (const [propertyName, propertyMetadata] of Object.entries(
4839
schema.properties
4940
)) {
50-
console.log('checking propertyName: ' + propertyName)
5141
const arrayPrefix = propertyMetadata.type === 'array' ? '.[]' : ''
5242
const row: FlattenedSchemaPropertyItem = {
5343
property: `${previousPropertyPrefix}${conditionalPropertyPrefix}${propertyName}`,
@@ -67,8 +57,7 @@ const recursivelyFormatNestedObjects = (
6757
propertyMetadata.items,
6858
rows,
6959
iteration + 1,
70-
row.property + arrayPrefix,
71-
true
60+
row.property + arrayPrefix
7261
)
7362
}
7463
}

0 commit comments

Comments
 (0)