feat(Structured Output Parser Node): Add notice about $refs support in JSON schema (#15973)

This commit is contained in:
Eugene
2025-06-05 09:51:03 +02:00
committed by GitHub
parent c57e697249
commit 47ad74d137
3 changed files with 13 additions and 25 deletions

View File

@@ -105,18 +105,6 @@ export class InformationExtractor implements INodeType {
} }
}`, }`,
}, },
{
displayName:
'The schema has to be defined in the <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format. Look at <a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">this</a> page for examples.',
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
schemaType: ['manual'],
},
},
},
{ {
displayName: 'Attributes', displayName: 'Attributes',
name: 'attributes', name: 'attributes',

View File

@@ -120,18 +120,6 @@ export class OutputParserStructured implements INodeType {
}, },
}, },
}, },
{
displayName:
'The schema has to be defined in the <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format. Look at <a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">this</a> page for examples.',
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
hide: {
schemaType: ['fromJson'],
},
},
},
{ {
displayName: 'Auto-Fix Format', displayName: 'Auto-Fix Format',
description: description:
@@ -172,6 +160,17 @@ export class OutputParserStructured implements INodeType {
'Prompt template used for fixing the output. Uses placeholders: "{instructions}" for parsing rules, "{completion}" for the failed attempt, and "{error}" for the validation error message.', 'Prompt template used for fixing the output. Uses placeholders: "{instructions}" for parsing rules, "{completion}" for the failed attempt, and "{error}" for the validation error message.',
}, },
], ],
hints: [
{
message:
'Fields that use $refs might have the wrong type, since this syntax is not currently supported',
type: 'warning',
location: 'outputPane',
whenToDisplay: 'afterExecution',
displayCondition:
'={{ $parameter["schemaType"] === "manual" && $parameter["inputSchema"]?.includes("$ref") }}',
},
],
}; };
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> { async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {

View File

@@ -12,7 +12,7 @@ export const schemaTypeField: INodeProperties = {
description: 'Generate a schema from an example JSON object', description: 'Generate a schema from an example JSON object',
}, },
{ {
name: 'Define Below', name: 'Define using JSON Schema',
value: 'manual', value: 'manual',
description: 'Define the JSON schema manually', description: 'Define the JSON schema manually',
}, },
@@ -71,6 +71,7 @@ export const buildInputSchemaField = (props?: {
}, },
}, },
description: 'Schema to use for the function', description: 'Schema to use for the function',
hint: 'Use <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format (<a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">examples</a>). $refs syntax is currently not supported.',
}); });
export const inputSchemaField = buildInputSchemaField(); export const inputSchemaField = buildInputSchemaField();