mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): exclude schemas with enum from anyOf detection (#11743)
### Changes 🏗️ Fixed the `isAnyOfSchema` function in schema-utils.ts to exclude schemas that have an `enum` property. This prevents incorrect schema processing for enums that also have anyOf definitions. Added a console.log statement in FormRenderer.tsx to help debug schema preprocessing. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Verified that forms with enum values render correctly - [x] Confirmed that anyOf schemas are properly identified and processed - [x] Tested with various schema combinations to ensure the fix doesn't break existing functionality <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Bug Fixes * Improved validation logic for form field schemas to correctly handle edge cases when multiple constraint types are defined. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { getUiOptions, RJSFSchema, UiSchema } from "@rjsf/utils";
|
||||
|
||||
export function isAnyOfSchema(schema: RJSFSchema | undefined): boolean {
|
||||
return Array.isArray(schema?.anyOf) && schema!.anyOf.length > 0;
|
||||
return (
|
||||
Array.isArray(schema?.anyOf) &&
|
||||
schema!.anyOf.length > 0 &&
|
||||
schema?.enum === undefined
|
||||
);
|
||||
}
|
||||
|
||||
export const isAnyOfChild = (
|
||||
|
||||
Reference in New Issue
Block a user