Refactor: Minor safety and modernization updates in processSchema#34
Refactor: Minor safety and modernization updates in processSchema#34Manas-Dikshit wants to merge 13 commits intowebpack:mainfrom
Conversation
alexander-akait
left a comment
There was a problem hiding this comment.
Is this AI generated code?
|
Hey @alexander-akait — I used AI assistance mainly for syntax suggestions and safety checks, but the logic and final implementation were manually reviewed and tested by me. It’s fully aligned with the existing behavior. If there is any mistakes or logic fall in the refined code then kindly suggest the changes. |
Updated JSDoc comments for better clarity and added type definitions.
Updated type definitions for SchemaVisitor and parameters in the processSchema function to use JSONSchema.
Updated comments for clarity and restructured constant definitions for nested schema traversal.
| * @typedef {Object} SchemaVisitor | ||
| * @property {(schema: JSONSchema | boolean, context?: ProcessContext) => JSONSchema | boolean | void} [schema] | ||
| * @property {(obj: JSONSchema | boolean, context?: ProcessContext) => JSONSchema | boolean | void} [object] | ||
| * @property {(arr: (JSONSchema | boolean)[], context?: ProcessContext) => void} [array] |
There was a problem hiding this comment.
Just interesting why we have boolean here?
There was a problem hiding this comment.
Good catch. JSON Schema allows boolean schemas, but instead of manually adding boolean I can switch to JSONSchema7Definition from json-schema types which already includes it.
can i ?
@alexander-akait
There was a problem hiding this comment.
We support more than JSONSchema7, it should be support old formats too
alexander-akait
left a comment
There was a problem hiding this comment.
/cc @bjohansebas Can you take a look at this too?



Changes
!json || typeof json !== 'object') have been added for improved recursion safety.visitor?.method) has been used instead of potentially throwing an error.for...infor enhanced compatibility.Impact