Skip to content

Commit 80d3abe

Browse files
fix(api-catalog): distinguish $defs keys for same-file property refs [DEVEX-965] (#168)
derive_defs_key_for_path keyed external $ref targets by bare file stem only, ignoring any #/properties/<name> fragment. Refs into different properties of the same model file (e.g. FulfillmentPlan.yaml's storeId vs orderId) collapsed onto one $defs key, so listFulfillments' storeId path parameter resolved to the order-reference schema instead of its own. Fold the property path into the derived key when present so distinct properties from the same file get distinct keys, then regenerate the catalog to pick up the fix.
1 parent 339db2d commit 80d3abe

4 files changed

Lines changed: 687 additions & 125 deletions

File tree

rust/schemas/api/fulfillments.json

Lines changed: 209 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,115 @@
133133
"type": "string"
134134
},
135135
"Fulfillment": {
136-
"description": "An identifier unique to the fulfillment (`Fulfillment_<KSUID>`). Auto-generated by our system on creation",
137-
"example": "Fulfillment_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
138-
"readOnly": true,
139-
"type": "string"
136+
"$id": "https://godaddy.com/schemas/commerce/fulfillment/fulfillment.v1",
137+
"$schema": "https://json-schema.org/draft/2020-12/schema",
138+
"description": "A fulfillment represents a task to fulfill one or more items from a single location for a single fulfillment mode. A Fulfillment can exist in the context of an order or be independent of one.",
139+
"properties": {
140+
"createdAt": {
141+
"$ref": "#/$defs/date-time"
142+
},
143+
"destination": {
144+
"$ref": "#/$defs/FulfillmentAddress"
145+
},
146+
"detailedStatus": {
147+
"$ref": "#/$defs/FulfillmentDetailedStatus"
148+
},
149+
"externalId": {
150+
"description": "External identifier for the fulfillment",
151+
"example": "FM-Y6BN43DB590L",
152+
"type": "string"
153+
},
154+
"fulfillmentPlanId": {
155+
"description": "Reference to the FulfillmentPlan this fulfillment was created from. Used for linking and reporting.",
156+
"example": "FulfillmentPlan_TG41sWEXyIktH8PY4eI0nOGDoB6",
157+
"type": "string"
158+
},
159+
"fulfillmentWindow": {
160+
"$ref": "#/$defs/FulfillmentWindow"
161+
},
162+
"history": {
163+
"description": "List of history events associated to the fulfillment",
164+
"items": {
165+
"$ref": "#/$defs/HistoryEvent"
166+
},
167+
"readOnly": true,
168+
"type": "array"
169+
},
170+
"id": {
171+
"description": "An identifier unique to the fulfillment (`Fulfillment_<KSUID>`). Auto-generated by our system on creation",
172+
"example": "Fulfillment_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
173+
"readOnly": true,
174+
"type": "string"
175+
},
176+
"inventoryBehavior": {
177+
"default": "OBEY_POLICY",
178+
"description": "Inventory policy for this fulfillment. Valid values: OBEY_POLICY (default), BYPASS. OBEY_POLICY decrements inventory and enforces stock checks; BYPASS skips inventory checks and allows fulfillment regardless of stock.",
179+
"enum": [
180+
"OBEY_POLICY",
181+
"BYPASS"
182+
],
183+
"type": "string"
184+
},
185+
"items": {
186+
"description": "Items in the fulfillment",
187+
"items": {
188+
"$ref": "#/$defs/FulfillmentItem"
189+
},
190+
"minItems": 1,
191+
"type": "array"
192+
},
193+
"locationId": {
194+
"description": "Reference to the Inventory Location (as defined by the Inventory Service) where the fulfillment was processed at",
195+
"type": "string"
196+
},
197+
"mode": {
198+
"$ref": "#/$defs/Mode"
199+
},
200+
"notes": {
201+
"description": "List of FulfillmentNote objects, used for internal or customer-facing notes.",
202+
"items": {
203+
"$ref": "#/$defs/FulfillmentNote"
204+
},
205+
"type": "array"
206+
},
207+
"orderId": {
208+
"description": "Reference to an order as defined by the Orders Service",
209+
"example": "Order_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
210+
"type": "string"
211+
},
212+
"origin": {
213+
"$ref": "#/$defs/FulfillmentAddress"
214+
},
215+
"status": {
216+
"$ref": "#/$defs/FulfillmentStatus"
217+
},
218+
"storeId": {
219+
"description": "ID of the store that the fulfillment belongs to",
220+
"example": "fd3d9291-dc9a-445d-aa68-d2ff1a77a83c",
221+
"type": "string"
222+
},
223+
"trackingData": {
224+
"description": "Tracking information for a fulfillment. The ability to have multiple tracking numbers for a single fulfillment is to support `last mile` shipping use cases. We do not support fulfilling multiple discrete sets of items (e.g. multiple boxes) in a single fulfillment",
225+
"items": {
226+
"$ref": "#/$defs/Tracking"
227+
},
228+
"type": "array"
229+
},
230+
"updatedAt": {
231+
"$ref": "#/$defs/date-time"
232+
}
233+
},
234+
"required": [
235+
"id",
236+
"storeId",
237+
"mode",
238+
"status",
239+
"detailedStatus",
240+
"locationId",
241+
"items"
242+
],
243+
"title": "Fulfillment",
244+
"type": "object"
140245
},
141246
"FulfillmentAddress": {
142247
"$id": "https://godaddy.com/schemas/commerce/fulfillment/fulfillment-address.v1",
@@ -346,9 +451,84 @@
346451
"type": "object"
347452
},
348453
"FulfillmentPlan": {
349-
"description": "Reference to an order as defined by the Orders Service",
350-
"example": "Order_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
351-
"type": "string"
454+
"$id": "https://godaddy.com/schemas/commerce/fulfillment/fulfillment-plan.v1",
455+
"$schema": "https://json-schema.org/draft/2020-12/schema",
456+
"description": "A fulfillment plan is a task list with instructions on how to fulfill a group of one or more items from an order from a single location for a single fulfillment mode. An order can have multiple fulfillment plans",
457+
"properties": {
458+
"cartId": {
459+
"description": "Optional reference to the cart associated with the order, if the order originated from a cart.",
460+
"type": "string"
461+
},
462+
"createdAt": {
463+
"$ref": "#/$defs/date-time"
464+
},
465+
"destination": {
466+
"$ref": "#/$defs/FulfillmentAddress"
467+
},
468+
"hasErrors": {
469+
"description": "True if any item in the plan encountered an error during inventory sync or fulfillment. This flag is set when errors are detected and is used to block further processing, trigger alerts, and surface issues for operator intervention.",
470+
"type": "boolean"
471+
},
472+
"history": {
473+
"description": "List of history events associated to the fulfillment plan",
474+
"items": {
475+
"$ref": "#/$defs/HistoryEvent"
476+
},
477+
"readOnly": true,
478+
"type": "array"
479+
},
480+
"id": {
481+
"description": "An identifier unique to the fulfillment plan (`FulfillmentPlan_<KSUID>`). Auto-generated by our system on creation",
482+
"example": "FulfillmentPlan_TG41sWEXyIktH8PY4eI0nOGDoB6",
483+
"readOnly": true,
484+
"type": "string"
485+
},
486+
"items": {
487+
"description": "Items in the fulfillment plan",
488+
"items": {
489+
"$ref": "#/$defs/FulfillmentPlanItem"
490+
},
491+
"minItems": 1,
492+
"type": "array"
493+
},
494+
"locationId": {
495+
"description": "Reference to the Inventory Location (as defined by the Inventory Service) where the fulfillment was processed at",
496+
"type": "string"
497+
},
498+
"mode": {
499+
"$ref": "#/$defs/Mode"
500+
},
501+
"orderId": {
502+
"description": "Reference to an order as defined by the Orders Service",
503+
"example": "Order_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
504+
"type": "string"
505+
},
506+
"origin": {
507+
"$ref": "#/$defs/FulfillmentAddress"
508+
},
509+
"status": {
510+
"$ref": "#/$defs/FulfillmentPlanStatus"
511+
},
512+
"storeId": {
513+
"description": "ID of the store that the fulfillment plan belongs to",
514+
"example": "6863480a-d0cb-46b5-8560-cd97d2c72d35",
515+
"type": "string"
516+
},
517+
"updatedAt": {
518+
"$ref": "#/$defs/date-time"
519+
}
520+
},
521+
"required": [
522+
"id",
523+
"storeId",
524+
"orderId",
525+
"mode",
526+
"status",
527+
"locationId",
528+
"items"
529+
],
530+
"title": "Fulfillment Plan",
531+
"type": "object"
352532
},
353533
"FulfillmentPlanItem": {
354534
"$id": "https://godaddy.com/schemas/commerce/fulfillment/fulfillment-plan-item.v1",
@@ -431,6 +611,16 @@
431611
"title": "Fulfillment Plan status",
432612
"type": "string"
433613
},
614+
"FulfillmentPlan_orderId": {
615+
"description": "Reference to an order as defined by the Orders Service",
616+
"example": "Order_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
617+
"type": "string"
618+
},
619+
"FulfillmentPlan_storeId": {
620+
"description": "ID of the store that the fulfillment plan belongs to",
621+
"example": "6863480a-d0cb-46b5-8560-cd97d2c72d35",
622+
"type": "string"
623+
},
434624
"FulfillmentStatus": {
435625
"$id": "https://godaddy.com/schemas/commerce/fulfillment/fulfillment-status.v1",
436626
"$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -463,6 +653,12 @@
463653
"title": "Fulfillment Window",
464654
"type": "object"
465655
},
656+
"Fulfillment_id": {
657+
"description": "An identifier unique to the fulfillment (`Fulfillment_<KSUID>`). Auto-generated by our system on creation",
658+
"example": "Fulfillment_2G5VsWEFhIktH8PY4qC0iOGDpVJ",
659+
"readOnly": true,
660+
"type": "string"
661+
},
466662
"HistoryEvent": {
467663
"$id": "https://godaddy.com/schemas/commerce/fulfillment/history-event.v1",
468664
"$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -702,7 +898,7 @@
702898
"name": "storeId",
703899
"required": true,
704900
"schema": {
705-
"$ref": "#/$defs/FulfillmentPlan"
901+
"$ref": "#/$defs/FulfillmentPlan_storeId"
706902
}
707903
},
708904
{
@@ -711,7 +907,7 @@
711907
"name": "orderId",
712908
"required": true,
713909
"schema": {
714-
"$ref": "#/$defs/FulfillmentPlan"
910+
"$ref": "#/$defs/FulfillmentPlan_orderId"
715911
}
716912
},
717913
{
@@ -837,7 +1033,7 @@
8371033
"name": "storeId",
8381034
"required": true,
8391035
"schema": {
840-
"$ref": "#/$defs/FulfillmentPlan"
1036+
"$ref": "#/$defs/FulfillmentPlan_storeId"
8411037
}
8421038
},
8431039
{
@@ -1000,7 +1196,7 @@
10001196
"name": "storeId",
10011197
"required": true,
10021198
"schema": {
1003-
"$ref": "#/$defs/FulfillmentPlan"
1199+
"$ref": "#/$defs/FulfillmentPlan_storeId"
10041200
}
10051201
}
10061202
],
@@ -1103,7 +1299,7 @@
11031299
"name": "storeId",
11041300
"required": true,
11051301
"schema": {
1106-
"$ref": "#/$defs/FulfillmentPlan"
1302+
"$ref": "#/$defs/FulfillmentPlan_storeId"
11071303
}
11081304
},
11091305
{
@@ -1112,7 +1308,7 @@
11121308
"name": "fulfillmentId",
11131309
"required": true,
11141310
"schema": {
1115-
"$ref": "#/$defs/Fulfillment"
1311+
"$ref": "#/$defs/Fulfillment_id"
11161312
}
11171313
}
11181314
],

0 commit comments

Comments
 (0)