@prorobotech/openapi-k8s-toolkit 1.5.0-alpha.1 → 1.5.0-alpha.3

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.
Files changed (52) hide show
  1. package/dist/{index-BFIWg9xn.mjs → index-BsjtTIr1.mjs} +3242 -679
  2. package/dist/index-BsjtTIr1.mjs.map +1 -0
  3. package/dist/{index-_9cT8fBl.mjs → index-D0cUc0Rp.mjs} +2 -2
  4. package/dist/{index-_9cT8fBl.mjs.map → index-D0cUc0Rp.mjs.map} +1 -1
  5. package/dist/openapi-k8s-toolkit.es.js +1 -1
  6. package/dist/openapi-k8s-toolkit.umd.js +3239 -676
  7. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  8. package/dist/types/components/molecules/BlackholeForm/atoms/DefaultValueButton/DefaultValueButton.d.ts +10 -0
  9. package/dist/types/components/molecules/BlackholeForm/atoms/DefaultValueButton/DefaultValueButton.test.d.ts +1 -0
  10. package/dist/types/components/molecules/BlackholeForm/atoms/DefaultValueButton/index.d.ts +1 -0
  11. package/dist/types/components/molecules/BlackholeForm/atoms/ExampleTooltipIcon/ExampleTooltipIcon.d.ts +6 -0
  12. package/dist/types/components/molecules/BlackholeForm/atoms/ExampleTooltipIcon/ExampleTooltipIcon.test.d.ts +1 -0
  13. package/dist/types/components/molecules/BlackholeForm/atoms/ExampleTooltipIcon/index.d.ts +1 -0
  14. package/dist/types/components/molecules/BlackholeForm/atoms/ExampleTooltipIcon/styled.d.ts +380 -0
  15. package/dist/types/components/molecules/BlackholeForm/atoms/NullToggleButton/NullToggleButton.d.ts +9 -0
  16. package/dist/types/components/molecules/BlackholeForm/atoms/NullToggleButton/NullToggleButton.test.d.ts +1 -0
  17. package/dist/types/components/molecules/BlackholeForm/atoms/NullToggleButton/index.d.ts +1 -0
  18. package/dist/types/components/molecules/BlackholeForm/atoms/index.d.ts +3 -0
  19. package/dist/types/components/molecules/BlackholeForm/molecules/FormBooleanInput/FormBooleanInput.d.ts +1 -0
  20. package/dist/types/components/molecules/BlackholeForm/molecules/FormBooleanInput/FormBooleanInput.test.d.ts +1 -0
  21. package/dist/types/components/molecules/BlackholeForm/molecules/FormEnumStringInput/FormEnumStringInput.d.ts +3 -0
  22. package/dist/types/components/molecules/BlackholeForm/molecules/FormListInput/FormListInput.d.ts +3 -0
  23. package/dist/types/components/molecules/BlackholeForm/molecules/FormNamespaceInput/FormNamespaceInput.d.ts +12 -0
  24. package/dist/types/components/molecules/BlackholeForm/molecules/FormNamespaceInput/FormNamespaceInput.test.d.ts +1 -0
  25. package/dist/types/components/molecules/BlackholeForm/molecules/FormNumberInput/FormNumberInput.d.ts +6 -0
  26. package/dist/types/components/molecules/BlackholeForm/molecules/FormObjectFromSwagger/FormObjectFromSwagger.d.ts +7 -6
  27. package/dist/types/components/molecules/BlackholeForm/molecules/FormStringInput/FormStringInput.d.ts +7 -0
  28. package/dist/types/components/molecules/BlackholeForm/molecules/FormStringMultilineInput/FormStringMultilineInput.d.ts +7 -0
  29. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/buildPlaceholder.d.ts +10 -0
  30. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/buildPlaceholder.test.d.ts +1 -0
  31. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/oneOfBranch.d.ts +9 -0
  32. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/oneOfBranch.test.d.ts +1 -0
  33. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/useDefaultValueButton.d.ts +11 -0
  34. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/useDefaultValueButton.test.d.ts +1 -0
  35. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/useNullToggleButton.d.ts +16 -0
  36. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/useNullToggleButton.test.d.ts +1 -0
  37. package/dist/types/components/molecules/BlackholeForm/molecules/helpers/validation.d.ts +35 -4
  38. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/BlackholeForm.d.ts +2 -2
  39. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/casts.d.ts +4 -4
  40. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/extractDefaultValue.d.ts +4 -0
  41. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/extractDefaultValue.test.d.ts +1 -0
  42. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/getSortedPropertyKeys.d.ts +2 -4
  43. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/oneOfBranchCleanup.d.ts +7 -0
  44. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/oneOfBranchCleanup.test.d.ts +1 -0
  45. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/oneOfBranchVisibility.d.ts +6 -0
  46. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/oneOfBranchVisibility.test.d.ts +1 -0
  47. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/utils.d.ts +52 -29
  48. package/dist/types/localTypes/bff/form.d.ts +4 -6
  49. package/dist/types/localTypes/formSchema.d.ts +42 -0
  50. package/dist/types/utils/normalizeValuesForQuotas/normalizeValuesForQuotas.d.ts +2 -2
  51. package/package.json +1 -1
  52. package/dist/index-BFIWg9xn.mjs.map +0 -1
@@ -0,0 +1,16 @@
1
+ import { TFormName } from '../../../../../localTypes/form';
2
+ type TNullToggleButtonState = {
3
+ visible: false;
4
+ } | {
5
+ visible: true;
6
+ isNull: boolean;
7
+ handleSetNull: () => void;
8
+ handleClear: () => void;
9
+ };
10
+ /**
11
+ * Surfaces a "Set null / Clear null" control only for schema nodes marked `nullable: true`.
12
+ * `null` is a distinct, persisted value (not the same as empty-and-omitted); consumers must
13
+ * propagate it through the submit pipeline for nullable paths.
14
+ */
15
+ export declare const useNullToggleButton: (formFieldName: TFormName, nullable?: boolean) => TNullToggleButtonState;
16
+ export {};
@@ -1,6 +1,37 @@
1
+ import { Rule } from 'antd/es/form';
2
+ import { TFormSchemaProperties } from '../../../../../localTypes/formSchema';
1
3
  import { TFormName } from '../../../../../localTypes/form';
2
4
  export declare const prettyFieldPath: (name: TFormName) => string;
3
- export declare const getRequiredRule: (isRequired: boolean, name: TFormName) => {
4
- required: boolean;
5
- message: string;
6
- };
5
+ export declare const collectOneOfRequiredGroupStates: ({ properties, values, currentPath, }: {
6
+ properties: TFormSchemaProperties;
7
+ values: Record<string, unknown>;
8
+ currentPath?: (string | number)[] | undefined;
9
+ }) => {
10
+ name: TFormName;
11
+ errors: string[];
12
+ }[];
13
+ /**
14
+ * Returns an antd Form rule for a required field. When `nullable` is true, an explicit
15
+ * `null` is accepted as a valid value (it will be serialized as JSON null in the payload).
16
+ * For non-nullable fields, the standard antd `required: true` semantics apply — null is
17
+ * treated as empty, same as undefined/''/[].
18
+ */
19
+ export declare const getRequiredRule: (isRequired: boolean, name: TFormName, nullable?: boolean) => Rule;
20
+ export declare const getPatternRule: (pattern: string | undefined, name: TFormName) => Rule | undefined;
21
+ export declare const getStringLengthRule: ({ minLength, maxLength, name, }: {
22
+ minLength?: number | undefined;
23
+ maxLength?: number | undefined;
24
+ name: TFormName;
25
+ }) => Rule | undefined;
26
+ export declare const getStringFormatRule: (format: string | undefined, name: TFormName) => Rule | undefined;
27
+ export declare const getArrayItemsRule: ({ minItems, maxItems, name, }: {
28
+ minItems?: number | undefined;
29
+ maxItems?: number | undefined;
30
+ name: TFormName;
31
+ }) => Rule | undefined;
32
+ export declare const getNumberFormatRule: (format: string | undefined, name: TFormName) => Rule | undefined;
33
+ export declare const getNumberRangeRule: ({ minimum, maximum, name, }: {
34
+ minimum?: number | undefined;
35
+ maximum?: number | undefined;
36
+ name: TFormName;
37
+ }) => Rule | undefined;
@@ -1,8 +1,8 @@
1
1
  import { FC } from 'react';
2
- import { OpenAPIV2 } from 'openapi-types';
3
2
  import { TJSON } from '../../../../../localTypes/JSON';
4
3
  import { TUrlParams } from '../../../../../localTypes/form';
5
4
  import { TFormPrefill } from '../../../../../localTypes/formExtensions';
5
+ import { TFormSchemaProperties } from '../../../../../localTypes/formSchema';
6
6
  export type TBlackholeFormProps = {
7
7
  cluster: string;
8
8
  theme: 'light' | 'dark';
@@ -12,7 +12,7 @@ export type TBlackholeFormProps = {
12
12
  plural?: string;
13
13
  };
14
14
  formsPrefills?: TFormPrefill;
15
- staticProperties: OpenAPIV2.SchemaObject['properties'];
15
+ staticProperties: TFormSchemaProperties;
16
16
  required: string[];
17
17
  hiddenPaths?: string[][];
18
18
  expandedPaths: string[][];
@@ -1,6 +1,6 @@
1
1
  import { MutableRefObject } from 'react';
2
- import { OpenAPIV2 } from 'openapi-types';
3
2
  import { TFormName } from '../../../../../../localTypes/form';
3
+ import { TFormSchemaProperties } from '../../../../../../localTypes/formSchema';
4
4
  export declare const pathKey: (p: (string | number)[]) => string;
5
5
  /**
6
6
  * Recursively prunes schema properties that are marked as "additional"
@@ -10,7 +10,7 @@ export declare const pathKey: (p: (string | number)[]) => string;
10
10
  * @param values - The actual data values that correspond to the schema.
11
11
  * @returns A new pruned copy of the schema `properties`.
12
12
  */
13
- export declare const pruneAdditionalForValues: (props: OpenAPIV2.SchemaObject['properties'], values: Record<string, unknown>, blockedPathsRef: MutableRefObject<Set<string>>) => OpenAPIV2.SchemaObject['properties'];
13
+ export declare const pruneAdditionalForValues: (props: TFormSchemaProperties, values: Record<string, unknown>, blockedPathsRef: MutableRefObject<Set<string>>) => TFormSchemaProperties;
14
14
  /**
15
15
  * Dynamically materializes (adds) new schema properties from the `values` object
16
16
  * whenever those properties correspond to `additionalProperties` in an OpenAPI schema.
@@ -36,8 +36,8 @@ export declare const pruneAdditionalForValues: (props: OpenAPIV2.SchemaObject['p
36
36
  * - `toExpand`: list of field paths that should be expanded (e.g., in a UI)
37
37
  * - `toPersist`: list of field paths that should be persisted (saved)
38
38
  */
39
- export declare const materializeAdditionalFromValues: (props: OpenAPIV2.SchemaObject['properties'], values: Record<string, unknown>, blockedPathsRef: MutableRefObject<Set<string>>) => {
40
- props: OpenAPIV2.SchemaObject['properties'];
39
+ export declare const materializeAdditionalFromValues: (props: TFormSchemaProperties, values: Record<string, unknown>, blockedPathsRef: MutableRefObject<Set<string>>) => {
40
+ props: TFormSchemaProperties;
41
41
  toExpand: TFormName[];
42
42
  toPersist: TFormName[];
43
43
  };
@@ -0,0 +1,4 @@
1
+ export declare const extractStringDefault: (value: unknown) => string | undefined;
2
+ export declare const extractNumberDefault: (value: unknown) => number | undefined;
3
+ export declare const extractBooleanDefault: (value: unknown) => boolean | undefined;
4
+ export declare const extractListInputDefault: (value: unknown) => string | string[] | undefined;
@@ -1,9 +1,7 @@
1
- import { OpenAPIV2 } from 'openapi-types';
2
1
  import { TFormName } from '../../../../../../localTypes/form';
2
+ import { TFormSchemaProperties } from '../../../../../../localTypes/formSchema';
3
3
  export declare const getSortedPropertyKeys: ({ name, sortPaths, properties, }: {
4
4
  name: TFormName;
5
5
  sortPaths?: string[][] | undefined;
6
- properties: {
7
- [name: string]: OpenAPIV2.SchemaObject;
8
- };
6
+ properties: TFormSchemaProperties;
9
7
  }) => (string | number)[];
@@ -0,0 +1,7 @@
1
+ import { TFormSchemaProperties } from '../../../../../../localTypes/formSchema';
2
+ export declare const collectInactiveBranchCleanupPaths: ({ properties, values, changedValues, currentPath, }: {
3
+ properties: TFormSchemaProperties;
4
+ values: Record<string, unknown>;
5
+ changedValues: Record<string, unknown> | undefined;
6
+ currentPath?: (string | number)[] | undefined;
7
+ }) => (string | number)[][];
@@ -0,0 +1,6 @@
1
+ import { TFormSchemaProperties } from '../../../../../../localTypes/formSchema';
2
+ export declare const collectOneOfBranchHiddenPaths: ({ properties, values, currentPath, }: {
3
+ properties: TFormSchemaProperties;
4
+ values: Record<string, unknown>;
5
+ currentPath?: (string | number)[] | undefined;
6
+ }) => (string | number)[][];
@@ -1,7 +1,7 @@
1
- import { OpenAPIV2 } from 'openapi-types';
2
1
  import { TListInputCustomProps, TRangeInputCustomProps } from '../../../../../localTypes/formExtensions';
3
2
  import { TFormName, TExpandedControls, TNamespaceData, TPersistedControls, TUrlParams } from '../../../../../localTypes/form';
4
- export declare const getStringFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, namespaceData, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, }: {
3
+ import { TFormSchemaNode, TFormSchemaProperties } from '../../../../../localTypes/formSchema';
4
+ export declare const getStringFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, namespaceData, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, defaultValue, example, nullable, format, pattern, minLength, maxLength, urlParams, }: {
5
5
  name: TFormName;
6
6
  arrKey?: number | undefined;
7
7
  arrName?: TFormName | undefined;
@@ -16,8 +16,16 @@ export declare const getStringFormItemFromSwagger: ({ name, arrKey, arrName, per
16
16
  }) => void;
17
17
  persistedControls: TPersistedControls;
18
18
  onRemoveByMinus?: (() => void) | undefined;
19
+ defaultValue?: string | undefined;
20
+ example?: string | undefined;
21
+ nullable?: boolean | undefined;
22
+ format?: string | undefined;
23
+ pattern?: string | undefined;
24
+ minLength?: number | undefined;
25
+ maxLength?: number | undefined;
26
+ urlParams?: TUrlParams | undefined;
19
27
  }) => import("react/jsx-runtime").JSX.Element;
20
- export declare const getEnumStringFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, options, persistedControls, onRemoveByMinus, }: {
28
+ export declare const getEnumStringFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, options, persistedControls, onRemoveByMinus, defaultValue, example, nullable, }: {
21
29
  name: TFormName;
22
30
  arrKey?: number | undefined;
23
31
  arrName?: TFormName | undefined;
@@ -32,8 +40,11 @@ export declare const getEnumStringFormItemFromSwagger: ({ name, arrKey, arrName,
32
40
  options: string[];
33
41
  persistedControls: TPersistedControls;
34
42
  onRemoveByMinus?: (() => void) | undefined;
43
+ defaultValue?: string | undefined;
44
+ example?: string | undefined;
45
+ nullable?: boolean | undefined;
35
46
  }) => import("react/jsx-runtime").JSX.Element;
36
- export declare const getNumberFormItemFromSwagger: ({ isNumber, name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, }: {
47
+ export declare const getNumberFormItemFromSwagger: ({ isNumber, name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, defaultValue, example, nullable, format, minimum, maximum, }: {
37
48
  isNumber?: boolean | undefined;
38
49
  name: TFormName;
39
50
  arrKey?: number | undefined;
@@ -48,6 +59,12 @@ export declare const getNumberFormItemFromSwagger: ({ isNumber, name, arrKey, ar
48
59
  }) => void;
49
60
  persistedControls: TPersistedControls;
50
61
  onRemoveByMinus?: (() => void) | undefined;
62
+ defaultValue?: number | undefined;
63
+ example?: number | undefined;
64
+ nullable?: boolean | undefined;
65
+ format?: string | undefined;
66
+ minimum?: number | undefined;
67
+ maximum?: number | undefined;
51
68
  }) => import("react/jsx-runtime").JSX.Element;
52
69
  export declare const getRangeInputFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isEdit, persistedControls, customProps, urlParams, onRemoveByMinus, }: {
53
70
  name: TFormName;
@@ -63,7 +80,7 @@ export declare const getRangeInputFormItemFromSwagger: ({ name, arrKey, arrName,
63
80
  urlParams: TUrlParams;
64
81
  onRemoveByMinus?: (() => void) | undefined;
65
82
  }) => import("react/jsx-runtime").JSX.Element;
66
- export declare const getStringMultilineFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, isBase64, }: {
83
+ export declare const getStringMultilineFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, onRemoveByMinus, isBase64, defaultValue, example, nullable, format, pattern, minLength, maxLength, }: {
67
84
  name: TFormName;
68
85
  arrKey?: number | undefined;
69
86
  arrName?: TFormName | undefined;
@@ -78,8 +95,15 @@ export declare const getStringMultilineFormItemFromSwagger: ({ name, arrKey, arr
78
95
  persistedControls: TPersistedControls;
79
96
  onRemoveByMinus?: (() => void) | undefined;
80
97
  isBase64?: boolean | undefined;
98
+ defaultValue?: string | undefined;
99
+ example?: string | undefined;
100
+ nullable?: boolean | undefined;
101
+ format?: string | undefined;
102
+ pattern?: string | undefined;
103
+ minLength?: number | undefined;
104
+ maxLength?: number | undefined;
81
105
  }) => import("react/jsx-runtime").JSX.Element;
82
- export declare const getListInputFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, customProps, urlParams, onRemoveByMinus, }: {
106
+ export declare const getListInputFormItemFromSwagger: ({ name, arrKey, arrName, persistName, required, forceNonRequired, description, isAdditionalProperties, removeField, persistedControls, customProps, urlParams, onRemoveByMinus, defaultValue, minItems, maxItems, }: {
83
107
  name: TFormName;
84
108
  arrKey?: number | undefined;
85
109
  arrName?: TFormName | undefined;
@@ -95,8 +119,11 @@ export declare const getListInputFormItemFromSwagger: ({ name, arrKey, arrName,
95
119
  customProps: TListInputCustomProps;
96
120
  urlParams: TUrlParams;
97
121
  onRemoveByMinus?: (() => void) | undefined;
122
+ defaultValue?: string | string[] | undefined;
123
+ minItems?: number | undefined;
124
+ maxItems?: number | undefined;
98
125
  }) => import("react/jsx-runtime").JSX.Element;
99
- export declare const getBooleanFormItemFromSwagger: ({ name, arrKey, arrName, description, makeValueUndefined, isAdditionalProperties, removeField, onRemoveByMinus, }: {
126
+ export declare const getBooleanFormItemFromSwagger: ({ name, arrKey, arrName, description, makeValueUndefined, isAdditionalProperties, removeField, onRemoveByMinus, defaultValue, }: {
100
127
  name: TFormName;
101
128
  arrKey?: number | undefined;
102
129
  arrName?: TFormName | undefined;
@@ -107,9 +134,10 @@ export declare const getBooleanFormItemFromSwagger: ({ name, arrKey, arrName, de
107
134
  path: TFormName;
108
135
  }) => void;
109
136
  onRemoveByMinus?: (() => void) | undefined;
137
+ defaultValue?: boolean | undefined;
110
138
  }) => import("react/jsx-runtime").JSX.Element;
111
- export declare const getArrayFormItemFromSwagger: ({ schema, name, arrKey, arrName, expandName, persistName, required, forceNonRequired, description, makeValueUndefined, addField, isAdditionalProperties, removeField, isEdit, expandedControls, persistedControls, sortPaths, urlParams, onRemoveByMinus, }: {
112
- schema: OpenAPIV2.SchemaObject;
139
+ export declare const getArrayFormItemFromSwagger: ({ schema, name, arrKey, arrName, expandName, persistName, required, forceNonRequired, description, makeValueUndefined, addField, isAdditionalProperties, removeField, isEdit, expandedControls, persistedControls, objectValidationErrors, sortPaths, urlParams, onRemoveByMinus, }: {
140
+ schema: TFormSchemaNode;
113
141
  name: TFormName;
114
142
  arrKey?: number | undefined;
115
143
  arrName?: TFormName | undefined;
@@ -123,10 +151,8 @@ export declare const getArrayFormItemFromSwagger: ({ schema, name, arrKey, arrNa
123
151
  path: TFormName;
124
152
  name: string;
125
153
  type: string;
126
- items?: {
127
- type: string;
128
- } | undefined;
129
- nestedProperties?: OpenAPIV2.SchemaObject['properties'];
154
+ items?: TFormSchemaNode | undefined;
155
+ nestedProperties?: TFormSchemaProperties | undefined;
130
156
  required?: string | undefined;
131
157
  }) => void;
132
158
  isAdditionalProperties?: boolean | undefined;
@@ -136,14 +162,13 @@ export declare const getArrayFormItemFromSwagger: ({ schema, name, arrKey, arrNa
136
162
  isEdit: boolean;
137
163
  expandedControls: TExpandedControls;
138
164
  persistedControls: TPersistedControls;
165
+ objectValidationErrors?: Record<string, string[]> | undefined;
139
166
  sortPaths?: string[][] | undefined;
140
167
  urlParams: TUrlParams;
141
168
  onRemoveByMinus?: (() => void) | undefined;
142
169
  }) => import("react/jsx-runtime").JSX.Element | null;
143
- export declare const getObjectFormItemsDraft: ({ properties, name, arrKey, arrName, expandName, persistName, required, forceNonRequired, description, namespaceData, makeValueUndefined, addField, removeField, isEdit, expandedControls, persistedControls, sortPaths, urlParams, }: {
144
- properties: {
145
- [name: string]: OpenAPIV2.SchemaObject;
146
- };
170
+ export declare const getObjectFormItemsDraft: ({ properties, name, arrKey, arrName, expandName, persistName, required, forceNonRequired, description, namespaceData, makeValueUndefined, addField, removeField, isEdit, expandedControls, persistedControls, objectValidationErrors, sortPaths, urlParams, }: {
171
+ properties: TFormSchemaProperties;
147
172
  name: TFormName;
148
173
  arrKey?: number | undefined;
149
174
  arrName?: TFormName | undefined;
@@ -158,10 +183,8 @@ export declare const getObjectFormItemsDraft: ({ properties, name, arrKey, arrNa
158
183
  path: TFormName;
159
184
  name: string;
160
185
  type: string;
161
- items?: {
162
- type: string;
163
- } | undefined;
164
- nestedProperties?: OpenAPIV2.SchemaObject['properties'];
186
+ items?: TFormSchemaNode | undefined;
187
+ nestedProperties?: TFormSchemaProperties | undefined;
165
188
  required?: string | undefined;
166
189
  }) => void;
167
190
  removeField: ({ path }: {
@@ -170,13 +193,15 @@ export declare const getObjectFormItemsDraft: ({ properties, name, arrKey, arrNa
170
193
  isEdit: boolean;
171
194
  expandedControls: TExpandedControls;
172
195
  persistedControls: TPersistedControls;
196
+ objectValidationErrors?: Record<string, string[]> | undefined;
173
197
  sortPaths?: string[][] | undefined;
174
198
  urlParams: TUrlParams;
175
199
  }) => import("react/jsx-runtime").JSX.Element;
176
- export declare const getObjectFormItemFromSwagger: ({ properties, name, arrKey, arrName, expandName, persistName, selfRequired, required, forceNonRequired, description, namespaceData, makeValueUndefined, addField, isAdditionalProperties, removeField, isEdit, expandedControls, persistedControls, sortPaths, urlParams, onRemoveByMinus, }: {
177
- properties: {
178
- [name: string]: OpenAPIV2.SchemaObject;
179
- };
200
+ export declare const getObjectFormItemFromSwagger: ({ properties, oneOfRequiredGroups, oneOfBranches, objectValidationErrors, name, arrKey, arrName, expandName, persistName, selfRequired, required, forceNonRequired, description, namespaceData, makeValueUndefined, addField, isAdditionalProperties, removeField, isEdit, expandedControls, persistedControls, sortPaths, urlParams, onRemoveByMinus, }: {
201
+ properties: TFormSchemaProperties;
202
+ oneOfRequiredGroups?: string[][] | undefined;
203
+ oneOfBranches?: TFormSchemaNode['oneOfBranches'];
204
+ objectValidationErrors?: Record<string, string[]> | undefined;
180
205
  name: TFormName;
181
206
  arrKey?: number | undefined;
182
207
  arrName?: TFormName | undefined;
@@ -192,10 +217,8 @@ export declare const getObjectFormItemFromSwagger: ({ properties, name, arrKey,
192
217
  path: TFormName;
193
218
  name: string;
194
219
  type: string;
195
- items?: {
196
- type: string;
197
- } | undefined;
198
- nestedProperties?: OpenAPIV2.SchemaObject['properties'];
220
+ items?: TFormSchemaNode | undefined;
221
+ nestedProperties?: TFormSchemaProperties | undefined;
199
222
  required?: string | undefined;
200
223
  }) => void;
201
224
  isAdditionalProperties?: boolean | undefined;
@@ -1,7 +1,7 @@
1
- import { OpenAPIV2 } from 'openapi-types';
2
1
  import { TJSON } from '../JSON';
3
2
  import { TFormName } from '../form';
4
3
  import { TFormPrefill } from '../formExtensions';
4
+ import { TFormSchemaProperties } from '../formSchema';
5
5
  export type TPrepareFormReq = {
6
6
  data: {
7
7
  type: 'builtin';
@@ -30,9 +30,7 @@ export type TPrepareFormRes = {
30
30
  isNamespaced: boolean;
31
31
  } | {
32
32
  result: 'success';
33
- properties: {
34
- [name: string]: OpenAPIV2.SchemaObject;
35
- };
33
+ properties: TFormSchemaProperties;
36
34
  required: string[] | undefined;
37
35
  hiddenPaths: string[][] | undefined;
38
36
  expandedPaths: string[][] | undefined;
@@ -47,11 +45,11 @@ export type TPrepareFormRes = {
47
45
  export type TYamlByValuesReq = {
48
46
  values: any;
49
47
  persistedKeys: TFormName[];
50
- properties: OpenAPIV2.SchemaObject['properties'];
48
+ properties: TFormSchemaProperties;
51
49
  };
52
50
  export type TYamlByValuesRes = any;
53
51
  export type TValuesByYamlReq = {
54
52
  values: Record<string, unknown>;
55
- properties: OpenAPIV2.SchemaObject['properties'];
53
+ properties: TFormSchemaProperties;
56
54
  };
57
55
  export type TValuesByYamlRes = any;
@@ -0,0 +1,42 @@
1
+ export type TFormSchemaKnownType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'listInput' | 'multilineString' | 'multilineStringBase64' | 'rangeInputCpu' | 'rangeInputMemory';
2
+ type TFormSchemaLooseType = TFormSchemaKnownType | (string & {});
3
+ export type TFormSchemaOneOfMatchValue = string | number | boolean;
4
+ export interface TFormSchemaOneOfBranch {
5
+ match?: Record<string, TFormSchemaOneOfMatchValue>;
6
+ required?: string[];
7
+ forbidden?: string[];
8
+ }
9
+ /**
10
+ * Mirror of the normalized form-schema contract returned by the BFF.
11
+ * Toolkit components should consume this type instead of raw OpenAPI v2 types.
12
+ */
13
+ export interface TFormSchemaNode {
14
+ type?: TFormSchemaLooseType | TFormSchemaLooseType[];
15
+ properties?: TFormSchemaProperties;
16
+ items?: TFormSchemaNode;
17
+ additionalProperties?: boolean | TFormSchemaNode;
18
+ required?: string[];
19
+ enum?: string[];
20
+ oneOfRequiredGroups?: string[][];
21
+ oneOfBranches?: TFormSchemaOneOfBranch[];
22
+ default?: unknown;
23
+ example?: unknown;
24
+ nullable?: boolean;
25
+ format?: string;
26
+ pattern?: string;
27
+ minLength?: number;
28
+ maxLength?: number;
29
+ minItems?: number;
30
+ maxItems?: number;
31
+ minimum?: number;
32
+ maximum?: number;
33
+ description?: string;
34
+ customProps?: unknown;
35
+ isAdditionalProperties?: boolean;
36
+ 'x-kubernetes-preserve-unknown-fields'?: boolean;
37
+ 'x-kubernetes-int-or-string'?: boolean;
38
+ }
39
+ export interface TFormSchemaProperties {
40
+ [name: string]: TFormSchemaNode;
41
+ }
42
+ export {};
@@ -1,2 +1,2 @@
1
- import { OpenAPIV2 } from 'openapi-types';
2
- export declare const normalizeValuesForQuotasToNumber: (object: any, properties: OpenAPIV2.SchemaObject['properties']) => any;
1
+ import { TFormSchemaProperties } from '../../localTypes/formSchema';
2
+ export declare const normalizeValuesForQuotasToNumber: (object: any, properties: TFormSchemaProperties) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.5.0-alpha.1",
3
+ "version": "1.5.0-alpha.3",
4
4
  "description": "ProRobotech OpenAPI k8s tools",
5
5
  "main": "dist/openapi-k8s-toolkit.cjs.js",
6
6
  "module": "dist/openapi-k8s-toolkit.es.js",