Skip to content

Commit

Permalink
Merge branch 'dev/1.10.4' into enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Dec 23, 2024
2 parents 3795031 + 0f243a0 commit ba0ac39
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/hooks/Schema/useSchemaForm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { PropType } from '@/types/enum'
import { Component, Properties, Property, Schema } from '@/types/schemaForm'
import axios from 'axios'
import { cloneDeep, get } from 'lodash'
Expand Down Expand Up @@ -213,10 +214,14 @@ export default function useSchemaForm(
property.is_template = property.is_template ?? getIsTemplateFromOneOfArr(property.oneOf)
const isSimpleOneof = oneOf.every(({ type }) => simpleTypes.includes(type))
if (isSimpleOneof && property.is_template) {
const withBoolean = oneOf.find(({ type }) => type === 'boolean')
property.type = withBoolean ? 'enum' : 'string'
property.symbols = withBoolean ? [true, false] : undefined
property.default = property.default ?? (withBoolean ? '' : undefined)
const justWithBoolean =
oneOf.length === 2 &&
oneOf.every(({ type }) =>
[PropType.Boolean, PropType.String].includes(type as PropType),
)
property.type = justWithBoolean ? 'enum' : 'string'
property.symbols = justWithBoolean ? [true, false] : undefined
property.default = property.default ?? (justWithBoolean ? '' : undefined)
}
}
if (!label) {
Expand Down

0 comments on commit ba0ac39

Please sign in to comment.