Skip to content

Commit eef8579

Browse files
author
Ruben van Leeuwen
committed
2076: Improve const value checking
1 parent b6b7239 commit eef8579

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/packages/pydantic-forms/src/core/hooks/usePydanticFormParser.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ const getPydanticFormField = (
7575
)
7676
: '';
7777

78-
const constValue = flatSchema.const || undefined;
78+
const addConstValue =
79+
typeof flatSchema.const === 'undefined' ? false : true;
7980

8081
const arrayItem = flatSchema.items
8182
? getPydanticFormField(
@@ -108,7 +109,7 @@ const getPydanticFormField = (
108109
required,
109110
validations,
110111
columns: 6, // TODO: Is this still relevant? https://github.com/workfloworchestrator/orchestrator-ui-library/issues/1891
111-
...(constValue && { const: constValue }),
112+
...(addConstValue && { const: flatSchema.const }),
112113
properties,
113114
...fieldDetailProvider?.[propertyId],
114115
};

0 commit comments

Comments
 (0)