Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| foreach ($properties as $childPropertyName => $childProperty) { | ||
| $childProperty = new Property( | ||
| $childPropertyName, | ||
| new Schema($childProperty), | ||
| in_array($childPropertyName, $nullable, true), |
There was a problem hiding this comment.
Instantiate Schema with SchemaInterface instance
The loop now receives SchemaInterface instances from ObjectSchema::properties(), but the code still wraps each one with new Schema($childProperty) where the Schema constructor requires an array. When any object has nested properties this call will throw a TypeError instead of generating components. Use the schema object directly or convert it with toArray() before constructing a new Schema.
Useful? React with 👍 / 👎.
| foreach($properties as $propertyName => $property) { | ||
| $property = new Property( | ||
| $propertyName, | ||
| new Schema($property->toArray()), | ||
| in_array($property, $nullable, true), | ||
| in_array($property, $required, true) |
There was a problem hiding this comment.
Nullable/required checks compare schema objects to names
Within generate(), $nullable and $required are arrays of property names from the schema, but the loop compares them with $property, which is the schema object, via in_array($property, $nullable, true) and in_array($property, $required, true). These comparisons always fail, so every generated Property is treated as not nullable and not required. The comparison should use $propertyName to correctly flag properties.
Useful? React with 👍 / 👎.
No description provided.