Skip to content

Commit 2698347

Browse files
authored
support loadingType as a top level field on the commonIdentifiers (#25)
# Summary **This PR addresses Issue #14: `Provide a way to show/provide Additional Appointment Details`** The specification includes a framework for [adding custom properties](https://freightapis.github.io/ssc/#section/Adding-Custom-Properties): > For the best integration experience for all parties, the SSC encourages the use of the API specification as-is. However, implementers may have specific requirements which may necessitate the addition of custom properties to the specification. However, multiple organizations have signaled the `loadingType` will be necessary. Since it is required for multiple organizations we can consider adding it to the specification rather than following the above guidelines for adding custom properties. This allows for the `loadingType` to be well defined while eliminating the need for a future proof vehicle for changes. # Proposed Changes 1. `loadingType` is optional when fetching available appointments 2. `loadingType` is returned as part of the fetch available appointment response 3. `loadingType` is required when booking an appointment # Discussion PR #17 is another possible solution to Issue #14. Below is some commentary comparing this PR to #17 as well as stating how this PR meets some requirements mentioned in the comments of Issue #14. ### Simplicity Adding well defined fields may be simpler than using `appointmentOptions`. Adding the `loadingType` to the `commonIdentifiers` object makes `loadingType` an integral part of fetching and scheduling appointments. It is clear which `loadingType` the client needs, reducing the number of responses when fetching appointments - only appointments that fit the specified `loadingType` will be returned. This also eliminates the need for client side filtering. If `appointmentOptions` is expanded to accommodate other use cases, excessive client side filtering may be required to find appointments that are a good fit. ### Maintainability Adding well defined fields may be more maintainable than `appointmentOptions`. ```yaml appointmentOptions: description: Options available for a specific appointment type: array items: anyOf: - $ref: '#/components/schemas/appointmentOptionLoadingType' - $ref: '#/components/schemas/appointmentOption' ``` The `appointmentOptions` provides specific guidelines regarding `appointmentOptionLoadingType` while leaving the `appointmentOption` open for future expansion. Will a future `appointmentOption` be added to the specification? If not, `appointmentOption` could see overlap and overuse if not formally defined as `appointmentOptionLoadingType` has been. An open ended property bag may be harder for clients to maintain. ### Meeting Requirements 1. The solution should be as future proof as possible 2. The solution should handle clients who do not know which loading types are available 3. The solution should handle appointments that are available for both LIVE and DROP #### The solution should be as future proof as possible This PR offers no framework for future proofing the specification. Adding a new field to the specification is an object change, requiring clients to update, rebuild, or regenerate their object to capture the new field. Yet this is no more effort than recognizing a new `appointmentOption`. Adding new data to one's implementation via the `appointmentOption` is still a breaking change because failure to read and evaluate the new `option` may cause the client to book unsuitable appointments. #### The solution should handle clients who do not know which loading types are available `loadingType` will be optional in `commonIdentifiers`. This allows clients to receive all available supported loading types if left blank in the request to fetch appointments. #### The solution should handle appointments that are available for both LIVE and DROP Some appointments may be available for multiple `loadingTypes`, such as a 2PM appointment available for both `LIVE` and `DROP`. Instead of making `loadingType` an `array`, the appointment can be duplicated like so ```json { "status": "SUCCESS", "appointments": [ { "id": "1", "appointmentType": "AUTOMATIC", "arrivalWindow": { "startDateTime": "2023-04-15T14:00:00.000-05:00", "duration": "PT1H" }, "loadingType": "LIVE" }, { "id": "2", "appointmentType": "AUTOMATIC", "arrivalWindow": { "startDateTime": "2023-04-15T14:00:00.000-05:00", "duration": "PT1H" }, "loadingType": "DROP" } ] } ``` `Note`: Denormalization can cause the number or responses to balloon as the size of the result set grows with both the number of fields and the number of options for each field. Clients should consider specifying as much as possible in the request body to make sure each available appointment returned is relevant.
1 parent b6cf2d9 commit 2698347

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

openapi.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.1.0
22
info:
33
title: 'Appointments'
4-
version: '1.0.1'
4+
version: '1.1.0'
55
contact:
66
name: Scheduling Standards Consortium
77
url: https://github.com/freightapis/ssc
@@ -726,6 +726,7 @@ paths:
726726
arrivalWindow:
727727
startDateTime: '2023-04-15T12:00:00.000-05:00'
728728
duration: 'PT1H'
729+
loadingType: 'LIVE'
729730
appointmentConfirmationNumber: 'C1234'
730731
appointmentStatus: 'CONFIRMED'
731732
failure:
@@ -988,6 +989,7 @@ webhooks:
988989
arrivalWindow:
989990
startDateTime: '2023-04-15T12:00:00.000-05:00'
990991
duration: 'PT1H'
992+
loadingType: 'LIVE'
991993
appointmentStatus: 'CONFIRMED'
992994
occurredAt: '2023-04-15T08:02:23.123Z'
993995
responses:
@@ -1047,6 +1049,7 @@ webhooks:
10471049
arrivalWindow:
10481050
startDateTime: '2023-04-15T12:00:00.000-05:00'
10491051
duration: 'PT1H'
1052+
loadingType: 'LIVE'
10501053
identifiers:
10511054
requestIdentifier: 'R1234'
10521055
occurredAt: '2023-04-15T08:02:23.123Z'
@@ -1078,6 +1081,7 @@ components:
10781081
arrivalWindow:
10791082
startDateTime: '2023-04-15T12:00:00.000-05:00'
10801083
duration: 'PT1H'
1084+
loadingType: 'LIVE'
10811085
modifiedAppointmentRequest:
10821086
summary: Minimum Required
10831087
description: This example is the bare minimum required to schedule/reschedule an appointment
@@ -1087,6 +1091,7 @@ components:
10871091
stopSequenceNumber: 1
10881092
preferredAppointment:
10891093
id: '1234'
1094+
loadingType: 'LIVE'
10901095
modifiedAppointmentResponseSuccess:
10911096
summary: Success
10921097
description: Example of a success response
@@ -1181,6 +1186,14 @@ components:
11811186
- DEFERRED
11821187
- FCFS
11831188
- CARRIER_CONFIRMATION_REQUIRED
1189+
loadingType:
1190+
type: string
1191+
description: |
1192+
- LIVE - Live load appointment
1193+
- DROP - Drop appointment
1194+
enum:
1195+
- LIVE
1196+
- DROP
11841197

11851198
# --- Core Entity Schemas --- #
11861199
clientRequestedAppointment:
@@ -1195,6 +1208,8 @@ components:
11951208
$ref: '#/components/schemas/availableAppointmentIdString'
11961209
appointmentType:
11971210
$ref: '#/components/schemas/appointmentType'
1211+
loadingType:
1212+
$ref: '#/components/schemas/loadingType'
11981213
- type: object
11991214
title: Appointment Details
12001215
description: The appointment details requested by the client
@@ -1209,6 +1224,8 @@ components:
12091224
$ref: '#/components/schemas/dockGroup'
12101225
dockDoor:
12111226
$ref: '#/components/schemas/dockDoor'
1227+
loadingType:
1228+
$ref: '#/components/schemas/loadingType'
12121229
availableAppointment:
12131230
type: object
12141231
title: Available Appointment
@@ -1224,6 +1241,8 @@ components:
12241241
$ref: '#/components/schemas/dockGroup'
12251242
dockDoor:
12261243
$ref: '#/components/schemas/dockDoor'
1244+
loadingType:
1245+
$ref: '#/components/schemas/loadingType'
12271246
appointment:
12281247
type: object
12291248
title: Appointment
@@ -1237,6 +1256,8 @@ components:
12371256
$ref: '#/components/schemas/dockGroup'
12381257
dockDoor:
12391258
$ref: '#/components/schemas/dockDoor'
1259+
loadingType:
1260+
$ref: '#/components/schemas/loadingType'
12401261
appointmentArrivalWindow:
12411262
type: object
12421263
description: The window of time that a carrier is allowed to arrive for the appointment. Specified by a start time and the duration of the arrival window.

0 commit comments

Comments
 (0)