feat(Structured Output Parser Node): Mark all parameters as required for schemas generated from JSON example (#15935)

This commit is contained in:
Eugene
2025-06-05 12:11:21 +02:00
committed by GitHub
parent 6cf07200dc
commit 7711e4b052
10 changed files with 980 additions and 21 deletions

View File

@@ -21,6 +21,10 @@ export const schemaTypeField: INodeProperties = {
description: 'How to specify the schema for the function',
};
/**
* Returns a field for inputting a JSON example that can be used to generate the schema.
* @param props
*/
export const buildJsonSchemaExampleField = (props?: {
showExtraProps?: Record<string, Array<NodeParameterValue | DisplayCondition> | undefined>;
}): INodeProperties => ({
@@ -43,6 +47,26 @@ export const buildJsonSchemaExampleField = (props?: {
description: 'Example JSON object to use to generate the schema',
});
/**
* Returns a notice field about the generated schema properties being required by default.
* @param props
*/
export const buildJsonSchemaExampleNotice = (props?: {
showExtraProps?: Record<string, Array<NodeParameterValue | DisplayCondition> | undefined>;
}): INodeProperties => ({
displayName:
"All properties will be required. To make them optional, use the 'JSON Schema' schema type instead",
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
...props?.showExtraProps,
schemaType: ['fromJson'],
},
},
});
export const jsonSchemaExampleField = buildJsonSchemaExampleField();
export const buildInputSchemaField = (props?: {