Make RateResponseRatedShipment::getTimeInTransit nullable#41
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request makes the TimeInTransit property nullable in the RateResponseRatedShipment model to handle cases where this information may not be present in API responses. The implementation follows established patterns in the codebase for handling nullable properties.
Changes:
- Added
nullable: trueto theRatedShipment_TimeInTransitschema definition in OpenAPI specification files - Updated the model class to allow null values for the
timeInTransitproperty, getter, and setter - Enhanced serialization/deserialization logic to properly handle null values during normalization and denormalization
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| openapi/Rating.yaml | Added nullable: true attribute to RatedShipment_TimeInTransit schema definition |
| openapi.yaml | Added nullable: true attribute to RatedShipment_TimeInTransit schema definition; also includes unrelated formatting changes |
| src/Api/Model/RateResponseRatedShipment.php | Updated property type annotations and method signatures to accept null values |
| src/Api/Normalizer/RateResponseRatedShipmentNormalizer.php | Added null handling in denormalization and updated normalization to work with nullable values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| post: | ||
| summary: 'Acceptance Audit Pre-check' | ||
| description: 'Enables shippers perform pre-checks before shipping dangerous goods using the chemical record identifier and the commodity''s regulated level code.' | ||
| description: "Enables shippers perform pre-checks before shipping dangerous goods using the chemical record identifier and the commodity's regulated level code." |
There was a problem hiding this comment.
The openapi.yaml file contains many changes that are not related to the TimeInTransit nullable update described in the PR. These include:
- Quote style changes throughout the file (converting escaped single quotes to double quotes, e.g., line 285, 846, and many others)
- Reordering of HTTP methods for the '/freight/{version}/pickups' endpoint (DELETE method moved before POST method, lines 8160-8206)
While these changes don't introduce functional issues, they make the PR harder to review and increase the risk of unintended changes. Consider separating formatting/style changes from functional changes in future PRs for better clarity and maintainability.
|
Thanks @zambodaniel! |
This pull request updates the handling of the
TimeInTransitproperty in the rating API response to allow for nullable values, improving compatibility with cases where this information may not be present. The changes affect the OpenAPI schema, the model, and the normalization/denormalization logic.OpenAPI schema update:
RatedShipment_TimeInTransitto be nullable in the OpenAPI definition, making it explicit that this field can be missing or null in responses.Model changes:
RateResponseRatedShipmentmodel so that thetimeInTransitproperty, its getter, and setter all acceptnullvalues, reflecting the schema change and preventing type errors when the property is absent. [1] [2]Serialization/deserialization logic:
RateResponseRatedShipmentNormalizerto correctly handleTimeInTransitbeingnullduring both denormalization (object creation from data) and normalization (object serialization). This ensures thatnullvalues are set and output properly, maintaining consistency with the model and schema. [1] [2]