Summary
BulkUpdateWarning.message is typed Optional[int], but the OFS REST API returns a string warning message. Any successful core.bulk_update whose results carry a warning raises a ValidationError when auto_model validates the 200 response.
Expected Behavior
A 200 response from /rest/ofscCore/v1/activities/custom-actions/bulkUpdate that contains warnings should validate cleanly into BulkUpdateResponse, with the warning text available on warning.message.
Actual Behavior
model.model_validate(data_response) (called by wrap_return when auto_model is enabled) raises:
pydantic_core._pydantic_core.ValidationError: N validation errors for BulkUpdateResponse
results.0.warnings.0.message
Input should be a valid integer, unable to parse string as an integer
For further information visit https://errors.pydantic.dev/2.13/v/int_parsing
...
Because the exception fires during response parsing, callers cannot tell that the server-side update actually succeeded — a successful bulk update is surfaced as a hard failure.
Steps to Reproduce
- Build a
BulkUpdateRequest that updates one or more activities in a way that produces an OFS warning (e.g. an update that moves an activity to a non-scheduled bucket, or any update the engine annotates with a warning).
- Call
instance.core.bulk_update(request) with auto_model enabled (the default).
- Observe the
ValidationError above instead of a parsed BulkUpdateResponse.
Minimal validation-only repro (no network needed), using a representative 200 body:
from ofsc.models import BulkUpdateResponse
raw = {
"results": [
{
"activityKeys": {"activityId": 4225, "apptNumber": "0010a000019oDas"},
"operationsPerformed": ["updateProperties", "updatePosition"],
"warnings": [
{"code": 1, "message": "Activity moved to a non-scheduled bucket"}
],
}
]
}
BulkUpdateResponse.model_validate(raw) # raises int_parsing ValidationError on warnings[].message
Environment
| Field |
Value |
| ofsc version |
2.24.1 |
| Python |
3.12 |
| pydantic |
2.13 |
Error Details
ValidationError: N validation errors for BulkUpdateResponse
results.<i>.warnings.0.message
Input should be a valid integer, unable to parse string as an integer
For further information visit https://errors.pydantic.dev/2.13/v/int_parsing
Impact
Major. Any consumer using core.bulk_update with auto_model (the default) cannot process a bulk update whose results include warnings — the whole response fails to parse, so legitimately-successful updates are indistinguishable from real failures. In a 310-activity batch load every row was reported as failed purely because the response carried string warning messages; the updates had in fact been applied server-side.
Proposed Solution
In ofsc/models/__init__.py, change BulkUpdateWarning.message from Optional[int] to Optional[str] (the API returns text). code remains Optional[int], which matches observed responses.
class BulkUpdateWarning(BaseModel):
code: Optional[int] = None
message: Optional[str] = None # was Optional[int]
If there's any concern about historical/numeric messages, Optional[str | int] is a backward-compatible superset.
Summary
BulkUpdateWarning.messageis typedOptional[int], but the OFS REST API returns a string warning message. Any successfulcore.bulk_updatewhose results carry a warning raises aValidationErrorwhenauto_modelvalidates the 200 response.Expected Behavior
A 200 response from
/rest/ofscCore/v1/activities/custom-actions/bulkUpdatethat contains warnings should validate cleanly intoBulkUpdateResponse, with the warning text available onwarning.message.Actual Behavior
model.model_validate(data_response)(called bywrap_returnwhenauto_modelis enabled) raises:Because the exception fires during response parsing, callers cannot tell that the server-side update actually succeeded — a successful bulk update is surfaced as a hard failure.
Steps to Reproduce
BulkUpdateRequestthat updates one or more activities in a way that produces an OFS warning (e.g. an update that moves an activity to a non-scheduled bucket, or any update the engine annotates with a warning).instance.core.bulk_update(request)withauto_modelenabled (the default).ValidationErrorabove instead of a parsedBulkUpdateResponse.Minimal validation-only repro (no network needed), using a representative 200 body:
Environment
Error Details
Impact
Major. Any consumer using
core.bulk_updatewithauto_model(the default) cannot process a bulk update whose results include warnings — the whole response fails to parse, so legitimately-successful updates are indistinguishable from real failures. In a 310-activity batch load every row was reported as failed purely because the response carried string warning messages; the updates had in fact been applied server-side.Proposed Solution
In
ofsc/models/__init__.py, changeBulkUpdateWarning.messagefromOptional[int]toOptional[str](the API returns text).coderemainsOptional[int], which matches observed responses.If there's any concern about historical/numeric messages,
Optional[str | int]is a backward-compatible superset.