Loading…
Loading…
Configure per-operation overrides for date/time formatting, time zones, and null value representation. Learn how to apply and validate these settings.
The Date/Time Handling Apply Service provides a mechanism for API publishers to set per-operation overrides for date, time, and timestamp handling. These settings allow fine-grained control over how date/time values are formatted for a specific API operation, overriding any system-wide defaults.
This service is part of the administrative API and is used to modify the configuration of an existing API operation. It directly updates the s2r_operation_mapping table with the specified overrides. The platform's runtime component then uses these per-operation settings as part of a resolution chain to determine the final date/time handling behavior. The resolution order is: per-field override, then per-operation override (this component), and finally the system default.
You can use this service to configure:
Changes can only be applied to operations belonging to a service version that is in a mutable state (e.g., a 'draft' version).
The service applies date/time handling overrides to a specific operation in a transactional, multi-step process. The core logic distinguishes between callers that supply the nullModeOverride field and those that omit it, ensuring backward compatibility.
flowchart TD
subgraph "Input Validation"
A[Start: apply() called] --> B{Validate all inputs};
B --> C{format='custom'?};
C -- Yes --> D{customPattern provided?};
D -- No --> Z1[Fail: S2R-VAL-0491];
C -- No --> E;
D -- Yes --> E;
E{timezone='local'?};
E -- Yes --> F{localTimezone provided?};
F -- No --> Z2[Fail: S2R-VAL-0492];
F -- Yes --> G;
E -- No --> G;
end
subgraph "Operation & Persistence"
G[Load Operation Metadata] --> H{Service version mutable?};
H -- No --> Z3[Fail: S2R-ADM-0410];
H -- Yes --> I{nullModeOverride supplied?};
I -- Yes --> J[UPDATE all 5 override columns in DB];
I -- No --> K[UPDATE 4 override columns, PRESERVE null_mode in DB];
J --> L{Update successful?};
K --> L;
L -- No --> Z4[Fail: S2R-ADM-0404];
end
subgraph "Result Construction"
L -- Yes --> M{nullModeOverride supplied?};
M -- Yes --> N[Use supplied nullMode for result];
M -- No --> O[Read preserved nullMode from DB];
N --> P[Construct ApplyResult];
O --> P;
P --> Q[End: Return ApplyResult];
end
Z1 --> Q;
Z2 --> Q;
Z3 --> Q;
Z4 --> Q;The process is as follows:
formatOverride, timezoneOverride, and nullModeOverride are checked against their respective sets of allowed values.customPatternOverride is validated as a syntactically correct date/time pattern.localTimezoneOverride is validated as a valid IANA time zone identifier.formatOverride is set to 'custom', then customPatternOverride must be provided.timezoneOverride is set to 'local', then localTimezoneOverride must be provided.operationId and verifies that its parent service version is in a mutable state (e.g., status is draft and it is not active). If the version is locked, the request is rejected.UPDATE against the s2r_operation_mapping table for the specified operationId. The behavior depends on whether the nullModeOverride was included in the request:
nullModeOverride Supplied: All five date/time override columns are updated. Providing an explicit null for nullModeOverride will clear the setting in the database, causing the operation to inherit the system default.nullModeOverride Omitted: Only the four other override columns (datetime_format_override, datetime_custom_pattern_override, datetime_timezone_override, datetime_local_timezone_override) are updated. The existing datetime_null_mode_override value is intentionally preserved. This ensures backward compatibility for older clients.ApplyResult object is returned. If nullModeOverride was omitted from the request, the service performs an additional database read to fetch the preserved value and include it in the response, ensuring the returned object accurately reflects the final persisted state.To apply overrides, invoke the service with the target operationId and the desired override values. A null value for any override parameter indicates that the operation should inherit the setting from a higher-level scope (e.g., the system default).
IMPORTANT
The nullModeOverride parameter has special behavior. To clear an existing override and inherit the system default, you must provide an explicit null for this parameter. If you omit the nullModeOverride field entirely from your request, its currently saved value will be preserved.
This example shows a conceptual invocation of the service to configure an operation to use a custom date format and a specific time zone.
Parameters:
operationId: a1b2c3d4-e5f6-7890-1234-567890abcdefformatOverride: "custom"customPatternOverride: "yyyy-MM-dd'T'HH:mm:ss.SSSX"timezoneOverride: "utc"localTimezoneOverride: nullnullModeOverride: "omit"nullModeSupplied: trueExecution:
The service validates the inputs, confirms the operation is mutable, and updates the corresponding record in the s2r_operation_mapping table.
Expected Result:
The service returns an ApplyResult object confirming the new settings.
{
"operationId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"operationKey": "find-widgets-by-id",
"formatOverride": "custom",
"customPatternOverride": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
"timezoneOverride": "utc",
"localTimezoneOverride": null,
"nullModeOverride": "omit"
}
The service exposes several public methods for applying overrides. The primary method takes seven arguments, providing full control over presence-aware updates. Convenience overloads are provided for backward compatibility and simpler use cases.
apply(operationId, formatOverride, customPatternOverride, timezoneOverride, localTimezoneOverride, nullModeOverride, nullModeSupplied)This is the primary, presence-aware method. It allows distinguishing between an omitted nullModeOverride field and an explicit null value.
apply(operationId, formatOverride, customPatternOverride, timezoneOverride, localTimezoneOverride, nullModeOverride)A 6-argument convenience method that assumes nullModeOverride was supplied. An explicit null for nullModeOverride will clear the persisted setting.
apply(operationId, formatOverride, customPatternOverride, timezoneOverride, localTimezoneOverride)A 5-argument backward-compatible method. It behaves as if nullModeOverride was omitted from the request, meaning any existing datetime_null_mode_override setting for the operation is preserved.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
operationId | UUID | Yes | — | The unique identifier of the operation to modify. |
formatOverride | String | No | — | The format override. Must be one of the supported format strings (e.g., iso, rfc, custom) or null to inherit. The source does not specify the complete list of valid formats. |
customPatternOverride | String | No | — | A custom date/time pattern, compliant with Java's DateTimeFormatter. Required if formatOverride is 'custom'. The source does not specify the maximum pattern length. |
timezoneOverride | String | No | — | The time zone override. Must be one of the supported timezone strings (e.g., utc, local) or null to inherit. The source does not specify the complete list of valid timezones. |
localTimezoneOverride | String | No | — | A valid IANA time zone ID (e.g., America/New_York). Required if timezoneOverride is 'local'. |
nullModeOverride | String | No | — | Defines how to represent null date/time values. Must be one of the supported modes (e.g., omit, null) or null to inherit. The source does not specify the complete list of valid modes. |
nullModeSupplied | boolean | Yes | — | An internal flag indicating if nullModeOverride was present in the request. true means the value will be set or cleared; false means the existing database value will be preserved. |
All apply methods return an ApplyResult object upon success.
| Field | Type | Description |
|---|---|---|
operationId | UUID | The ID of the operation that was updated. |
operationKey | String | The key of the operation that was updated. |
formatOverride | String | The applied format override. |
customPatternOverride | String | The applied custom pattern override. |
timezoneOverride | String | The applied time zone override. |
localTimezoneOverride | String | The applied local time zone override. |
nullModeOverride | String | The final, persisted null mode override. This will reflect a preserved value if nullModeSupplied was false. |
If an apply call fails, the service throws an ApplyValidationException containing a machine-readable error code and a descriptive message.
| Error Code | Reason |
|---|---|
S2R-VAL-0490 | formatOverride is not one of the allowed values. |
S2R-VAL-0491 | Invalid customPatternOverride. This can occur if it is missing when formatOverride is 'custom', if it exceeds the maximum allowed length, or if its syntax is invalid. |
S2R-VAL-0492 | Invalid localTimezoneOverride. This can occur if it is missing when timezoneOverride is 'local' or if it is not a valid IANA time zone ID. |
S2R-VAL-0493 | timezoneOverride is not one of the allowed values. |
S2R-VAL-0494 | nullModeOverride is not one of the allowed values. |
S2R-ADM-0404 | The specified operationId does not exist, or no active mapping was found for it. |
S2R-ADM-0410 | The operation's service version is not in a mutable state (e.g., it is active or not in 'draft' status). |