@crvouga/mockingbird-service-google-maps 1.8.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.yaml ADDED
@@ -0,0 +1,747 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Google Places, Geocoding and Maps JavaScript API (Mockingbird subset)
4
+ description: |
5
+ The Google Maps Platform surface our member app calls: Places Autocomplete, Place Details
6
+ and Find Place From Text (the legacy JSON web services), the Geocoding API, and the Maps
7
+ JavaScript API loader (`/maps/api/js?libraries=places`). Every web-service answer is HTTP 200
8
+ with Google's `status` field; the mock resolves addresses from a QA corpus.
9
+ version: "1"
10
+ x-mockingbird-upstream:
11
+ note: >-
12
+ Hand-authored from Google's documented response shapes and the fields our consumer
13
+ reads (address-autocomplete-native-rest.tsx, address-autocomplete-web.tsx,
14
+ use-geocoded-address.ts). Google publishes no OpenAPI document for these endpoints.
15
+ servers:
16
+ - url: https://maps.googleapis.com
17
+ paths:
18
+ /maps/api/place/autocomplete/json:
19
+ get:
20
+ operationId: PlaceAutocomplete
21
+ x-mockingbird:
22
+ supported: true
23
+ parity:
24
+ enabled: true
25
+ safe: true
26
+ parameters:
27
+ - $ref: "#/components/parameters/Key"
28
+ - name: input
29
+ in: query
30
+ required: true
31
+ schema:
32
+ type: string
33
+ minLength: 1
34
+ maxLength: 60
35
+ examples:
36
+ - "1625 N Central"
37
+ - "Phoenix"
38
+ - "85004"
39
+ - "4821 Maple Street Denver"
40
+ - "200 N Spring St, Los Angeles"
41
+ - "136 Murray"
42
+ - name: types
43
+ in: query
44
+ schema:
45
+ type: string
46
+ enum: [address, geocode]
47
+ - name: components
48
+ in: query
49
+ schema:
50
+ type: string
51
+ enum: ["country:us", "country:ca", "country:us|country:ca"]
52
+ - $ref: "#/components/parameters/SessionToken"
53
+ responses:
54
+ "200":
55
+ description: Predictions, or a non-OK status (HTTP 200 either way)
56
+ content:
57
+ application/json:
58
+ schema:
59
+ $ref: "#/components/schemas/AutocompleteResponse"
60
+ "500":
61
+ description: Google front-end failure (server_error preset)
62
+ content:
63
+ application/json:
64
+ schema:
65
+ type: object
66
+ /maps/api/place/details/json:
67
+ get:
68
+ operationId: PlaceDetails
69
+ x-mockingbird:
70
+ supported: true
71
+ parity:
72
+ enabled: true
73
+ safe: true
74
+ parameters:
75
+ - $ref: "#/components/parameters/Key"
76
+ - name: place_id
77
+ in: query
78
+ required: true
79
+ schema:
80
+ type: string
81
+ minLength: 1
82
+ maxLength: 200
83
+ examples:
84
+ - ChIJ5BKAwJuCB5951g03ZzrkHx9
85
+ - ChIJE1ellR5XyWiy2lHIlJ5cls3
86
+ - ChIJaWYsCINV1XBQQ97jO3pznpg
87
+ - EieyJsIjoiNDgyMSBNYXBsZSBTdHJlZXQiLCJjIjoiRGVudmVyIiwicyI6IkNPIiwieiI6IjgwMjAyIiwibiI6IkRlbnZlciBDb3VudHkiLCJhIjozOS43NDc4OCwibyI6LTEwNC45OTQyNX0
88
+ - ChIJdoesNotExist000000000
89
+ - name: fields
90
+ in: query
91
+ schema:
92
+ type: string
93
+ enum:
94
+ - address_component
95
+ - address_components
96
+ - geometry
97
+ - formatted_address,geometry
98
+ - place_id,name,types
99
+ - address_component,geometry,formatted_address
100
+ - $ref: "#/components/parameters/SessionToken"
101
+ responses:
102
+ "200":
103
+ description: The place, or a non-OK status
104
+ content:
105
+ application/json:
106
+ schema:
107
+ $ref: "#/components/schemas/DetailsResponse"
108
+ "500":
109
+ description: Google front-end failure (server_error preset)
110
+ content:
111
+ application/json:
112
+ schema:
113
+ type: object
114
+ /maps/api/geocode/json:
115
+ get:
116
+ operationId: Geocode
117
+ x-mockingbird:
118
+ supported: true
119
+ parity:
120
+ enabled: true
121
+ safe: true
122
+ parameters:
123
+ - $ref: "#/components/parameters/Key"
124
+ - name: address
125
+ in: query
126
+ schema:
127
+ type: string
128
+ minLength: 1
129
+ maxLength: 80
130
+ examples:
131
+ - "1625 N Central Ave, Phoenix, AZ 85004"
132
+ - "88 Greenwich St, New York, NY 10006"
133
+ - "4821 Maple Street, Denver, CO 80202"
134
+ - "85004"
135
+ - "Phoenix, AZ"
136
+ - "1625 N Central Ave"
137
+ - name: place_id
138
+ in: query
139
+ schema:
140
+ type: string
141
+ examples:
142
+ - ChIJ5BKAwJuCB5951g03ZzrkHx9
143
+ - name: components
144
+ in: query
145
+ schema:
146
+ type: string
147
+ enum: ["postal_code:85004", "postal_code:10006", "postal_code:00000"]
148
+ responses:
149
+ "200":
150
+ description: Geocoding results, or a non-OK status
151
+ content:
152
+ application/json:
153
+ schema:
154
+ $ref: "#/components/schemas/GeocodeResponse"
155
+ "500":
156
+ description: Google front-end failure (server_error preset)
157
+ content:
158
+ application/json:
159
+ schema:
160
+ type: object
161
+ /maps/api/place/findplacefromtext/json:
162
+ get:
163
+ operationId: FindPlaceFromText
164
+ x-mockingbird:
165
+ supported: true
166
+ parity:
167
+ enabled: true
168
+ safe: true
169
+ parameters:
170
+ - $ref: "#/components/parameters/Key"
171
+ - name: input
172
+ in: query
173
+ required: true
174
+ schema:
175
+ type: string
176
+ minLength: 1
177
+ maxLength: 80
178
+ examples:
179
+ - "1625 N Central Ave, Phoenix, AZ 85004"
180
+ - "1625 N Central"
181
+ - "Gilbert"
182
+ - name: inputtype
183
+ in: query
184
+ required: true
185
+ schema:
186
+ type: string
187
+ enum: [textquery, phonenumber]
188
+ - name: fields
189
+ in: query
190
+ schema:
191
+ type: string
192
+ enum: [geometry, "formatted_address,geometry", "place_id,name", place_id]
193
+ responses:
194
+ "200":
195
+ description: Candidates, or a non-OK status
196
+ content:
197
+ application/json:
198
+ schema:
199
+ $ref: "#/components/schemas/FindPlaceResponse"
200
+ "500":
201
+ description: Google front-end failure (server_error preset)
202
+ content:
203
+ application/json:
204
+ schema:
205
+ type: object
206
+ /maps/api/js:
207
+ get:
208
+ operationId: MapsJavaScriptApi
209
+ description: >-
210
+ The Maps JavaScript API loader. The mock serves a shim defining google.maps.places
211
+ (AutocompleteService, PlacesService, AutocompleteSessionToken, PlacesServiceStatus) and
212
+ google.maps.Geocoder, backed by the REST operations above.
213
+ x-mockingbird:
214
+ supported: true
215
+ parity:
216
+ enabled: false
217
+ reason: >-
218
+ A JavaScript program, not data: it is exercised by evaluating it in a fake window
219
+ and driving our web client through it (google-maps.acceptance.test.ts).
220
+ parameters:
221
+ - name: key
222
+ in: query
223
+ schema:
224
+ type: string
225
+ - name: libraries
226
+ in: query
227
+ schema:
228
+ type: string
229
+ - name: callback
230
+ in: query
231
+ schema:
232
+ type: string
233
+ - name: v
234
+ in: query
235
+ schema:
236
+ type: string
237
+ responses:
238
+ "200":
239
+ description: The Maps JavaScript shim
240
+ content:
241
+ text/javascript:
242
+ schema:
243
+ type: string
244
+ "503":
245
+ description: Script unavailable (script_unavailable preset)
246
+ content:
247
+ text/plain:
248
+ schema:
249
+ type: string
250
+ /v1:validateAddress:
251
+ servers:
252
+ - url: https://addressvalidation.googleapis.com
253
+ post:
254
+ operationId: ValidateAddress
255
+ description: >-
256
+ Address Validation API v1 validateAddress, with USPS CASS data (`enableUspsCass`). A
257
+ Google Cloud API: errors are HTTP 4xx/5xx with a `google.rpc.Status` envelope, and the
258
+ key may also be sent as the `X-Goog-Api-Key` header. Responses are proto3 JSON (false
259
+ booleans and empty lists omitted). Reference:
260
+ https://developers.google.com/maps/documentation/address-validation/reference/rest/v1/TopLevel/validateAddress
261
+ x-mockingbird:
262
+ supported: true
263
+ parity:
264
+ enabled: true
265
+ safe: true
266
+ parameters:
267
+ - $ref: "#/components/parameters/Key"
268
+ requestBody:
269
+ required: true
270
+ content:
271
+ application/json:
272
+ schema:
273
+ $ref: "#/components/schemas/ValidateAddressRequest"
274
+ responses:
275
+ "200":
276
+ description: The validation result
277
+ content:
278
+ application/json:
279
+ schema:
280
+ $ref: "#/components/schemas/ValidateAddressResponse"
281
+ "400":
282
+ description: INVALID_ARGUMENT (malformed request, unsupported region, invalid API key)
283
+ content:
284
+ application/json:
285
+ schema:
286
+ $ref: "#/components/schemas/GoogleApiError"
287
+ "403":
288
+ description: PERMISSION_DENIED (missing key; address_validation_denied preset)
289
+ content:
290
+ application/json:
291
+ schema:
292
+ $ref: "#/components/schemas/GoogleApiError"
293
+ "503":
294
+ description: UNAVAILABLE (address_validation_unavailable preset)
295
+ content:
296
+ application/json:
297
+ schema:
298
+ $ref: "#/components/schemas/GoogleApiError"
299
+ components:
300
+ parameters:
301
+ Key:
302
+ name: key
303
+ in: query
304
+ required: true
305
+ description: The Google Maps Platform API key (`PLACES_KEY`); also the namespace credential.
306
+ schema:
307
+ type: string
308
+ minLength: 1
309
+ maxLength: 40
310
+ examples: [parity-key]
311
+ SessionToken:
312
+ name: sessiontoken
313
+ in: query
314
+ description: Autocomplete session token (billing grouping); accepted and journaled as metadata.
315
+ schema:
316
+ type: string
317
+ format: uuid
318
+ schemas:
319
+ Status:
320
+ type: string
321
+ enum:
322
+ - OK
323
+ - ZERO_RESULTS
324
+ - INVALID_REQUEST
325
+ - OVER_QUERY_LIMIT
326
+ - REQUEST_DENIED
327
+ - UNKNOWN_ERROR
328
+ - NOT_FOUND
329
+ LatLng:
330
+ type: object
331
+ required: [lat, lng]
332
+ properties:
333
+ lat:
334
+ type: number
335
+ lng:
336
+ type: number
337
+ Viewport:
338
+ type: object
339
+ required: [northeast, southwest]
340
+ properties:
341
+ northeast:
342
+ $ref: "#/components/schemas/LatLng"
343
+ southwest:
344
+ $ref: "#/components/schemas/LatLng"
345
+ Geometry:
346
+ type: object
347
+ required: [location, viewport]
348
+ properties:
349
+ location:
350
+ $ref: "#/components/schemas/LatLng"
351
+ location_type:
352
+ type: string
353
+ enum: [ROOFTOP, RANGE_INTERPOLATED, GEOMETRIC_CENTER, APPROXIMATE]
354
+ viewport:
355
+ $ref: "#/components/schemas/Viewport"
356
+ AddressComponent:
357
+ type: object
358
+ required: [long_name, short_name, types]
359
+ properties:
360
+ long_name:
361
+ type: string
362
+ short_name:
363
+ type: string
364
+ types:
365
+ type: array
366
+ items:
367
+ type: string
368
+ MatchedSubstring:
369
+ type: object
370
+ required: [length, offset]
371
+ properties:
372
+ length:
373
+ type: integer
374
+ offset:
375
+ type: integer
376
+ Prediction:
377
+ type: object
378
+ required: [description, place_id, reference, structured_formatting, terms, types, matched_substrings]
379
+ properties:
380
+ description:
381
+ type: string
382
+ matched_substrings:
383
+ type: array
384
+ items:
385
+ $ref: "#/components/schemas/MatchedSubstring"
386
+ place_id:
387
+ type: string
388
+ x-mockingbird-resource:
389
+ type: place
390
+ identity: true
391
+ reference:
392
+ type: string
393
+ structured_formatting:
394
+ type: object
395
+ required: [main_text, secondary_text]
396
+ properties:
397
+ main_text:
398
+ type: string
399
+ main_text_matched_substrings:
400
+ type: array
401
+ items:
402
+ $ref: "#/components/schemas/MatchedSubstring"
403
+ secondary_text:
404
+ type: string
405
+ terms:
406
+ type: array
407
+ items:
408
+ type: object
409
+ required: [offset, value]
410
+ properties:
411
+ offset:
412
+ type: integer
413
+ value:
414
+ type: string
415
+ types:
416
+ type: array
417
+ items:
418
+ type: string
419
+ PlaceResult:
420
+ type: object
421
+ description: Only the fields requested with `fields=` are present.
422
+ properties:
423
+ address_components:
424
+ type: array
425
+ items:
426
+ $ref: "#/components/schemas/AddressComponent"
427
+ adr_address:
428
+ type: string
429
+ formatted_address:
430
+ type: string
431
+ geometry:
432
+ $ref: "#/components/schemas/Geometry"
433
+ name:
434
+ type: string
435
+ place_id:
436
+ type: string
437
+ reference:
438
+ type: string
439
+ types:
440
+ type: array
441
+ items:
442
+ type: string
443
+ url:
444
+ type: string
445
+ utc_offset:
446
+ type: integer
447
+ vicinity:
448
+ type: string
449
+ AutocompleteResponse:
450
+ type: object
451
+ required: [predictions, status]
452
+ properties:
453
+ predictions:
454
+ type: array
455
+ items:
456
+ $ref: "#/components/schemas/Prediction"
457
+ status:
458
+ $ref: "#/components/schemas/Status"
459
+ error_message:
460
+ type: string
461
+ DetailsResponse:
462
+ type: object
463
+ required: [html_attributions, status]
464
+ properties:
465
+ html_attributions:
466
+ type: array
467
+ items:
468
+ type: string
469
+ result:
470
+ $ref: "#/components/schemas/PlaceResult"
471
+ status:
472
+ $ref: "#/components/schemas/Status"
473
+ error_message:
474
+ type: string
475
+ GeocodeResult:
476
+ type: object
477
+ required: [address_components, formatted_address, geometry, place_id, types]
478
+ properties:
479
+ address_components:
480
+ type: array
481
+ items:
482
+ $ref: "#/components/schemas/AddressComponent"
483
+ formatted_address:
484
+ type: string
485
+ geometry:
486
+ $ref: "#/components/schemas/Geometry"
487
+ place_id:
488
+ type: string
489
+ types:
490
+ type: array
491
+ items:
492
+ type: string
493
+ GeocodeResponse:
494
+ type: object
495
+ required: [results, status]
496
+ properties:
497
+ results:
498
+ type: array
499
+ items:
500
+ $ref: "#/components/schemas/GeocodeResult"
501
+ status:
502
+ $ref: "#/components/schemas/Status"
503
+ error_message:
504
+ type: string
505
+ FindPlaceResponse:
506
+ type: object
507
+ required: [candidates, status]
508
+ properties:
509
+ candidates:
510
+ type: array
511
+ items:
512
+ $ref: "#/components/schemas/PlaceResult"
513
+ status:
514
+ $ref: "#/components/schemas/Status"
515
+ error_message:
516
+ type: string
517
+ GoogleApiError:
518
+ type: object
519
+ required: [error]
520
+ properties:
521
+ error:
522
+ type: object
523
+ required: [code, message, status]
524
+ properties:
525
+ code:
526
+ type: integer
527
+ message:
528
+ type: string
529
+ status:
530
+ type: string
531
+ details:
532
+ type: array
533
+ items:
534
+ type: object
535
+ PostalAddress:
536
+ type: object
537
+ description: google.type.PostalAddress
538
+ properties:
539
+ revision:
540
+ type: integer
541
+ regionCode:
542
+ type: string
543
+ examples: [US]
544
+ languageCode:
545
+ type: string
546
+ postalCode:
547
+ type: string
548
+ examples: ["85004", "10006", "80202", "90012", "00000"]
549
+ sortingCode:
550
+ type: string
551
+ administrativeArea:
552
+ type: string
553
+ examples: [AZ, NY, CO, CA]
554
+ locality:
555
+ type: string
556
+ examples: [Phoenix, New York, Denver, Los Angeles, Springfield]
557
+ sublocality:
558
+ type: string
559
+ addressLines:
560
+ type: array
561
+ maxItems: 3
562
+ items:
563
+ type: string
564
+ maxLength: 80
565
+ examples:
566
+ - "1625 N Central Ave"
567
+ - "1625 North Central Avenue Building A"
568
+ - "4821 Maple Street"
569
+ - "N Central Ave"
570
+ - "Apt 2"
571
+ recipients:
572
+ type: array
573
+ items:
574
+ type: string
575
+ organization:
576
+ type: string
577
+ ValidateAddressRequest:
578
+ type: object
579
+ required: [address]
580
+ additionalProperties: false
581
+ properties:
582
+ address:
583
+ $ref: "#/components/schemas/PostalAddress"
584
+ examples:
585
+ - regionCode: US
586
+ addressLines: ["1625 N Central Ave"]
587
+ locality: Phoenix
588
+ administrativeArea: AZ
589
+ postalCode: "85004"
590
+ - regionCode: US
591
+ addressLines: ["4821 Maple Street"]
592
+ locality: Denver
593
+ administrativeArea: CO
594
+ postalCode: "80202"
595
+ - regionCode: US
596
+ addressLines: ["N Central Ave"]
597
+ locality: Phoenix
598
+ administrativeArea: AZ
599
+ postalCode: "85004"
600
+ - regionCode: US
601
+ addressLines: ["1625 N Central Ave, Phoenix, AZ 85004"]
602
+ - regionCode: US
603
+ addressLines: ["12 Nowhere Rd"]
604
+ locality: Springfield
605
+ administrativeArea: ZZ
606
+ postalCode: "00000"
607
+ previousResponseId:
608
+ type: string
609
+ enableUspsCass:
610
+ type: boolean
611
+ languageOptions:
612
+ type: object
613
+ sessionToken:
614
+ type: string
615
+ ValidationAddressComponent:
616
+ type: object
617
+ required: [componentName, componentType, confirmationLevel]
618
+ properties:
619
+ componentName:
620
+ type: object
621
+ required: [text]
622
+ properties:
623
+ text:
624
+ type: string
625
+ languageCode:
626
+ type: string
627
+ componentType:
628
+ type: string
629
+ confirmationLevel:
630
+ type: string
631
+ enum: [CONFIRMED, UNCONFIRMED_BUT_PLAUSIBLE, UNCONFIRMED_AND_SUSPICIOUS]
632
+ inferred:
633
+ type: boolean
634
+ spellCorrected:
635
+ type: boolean
636
+ replaced:
637
+ type: boolean
638
+ unexpected:
639
+ type: boolean
640
+ Granularity:
641
+ type: string
642
+ enum: [GRANULARITY_UNSPECIFIED, SUB_PREMISE, PREMISE, PREMISE_PROXIMITY, BLOCK, ROUTE, OTHER]
643
+ ValidationResult:
644
+ type: object
645
+ properties:
646
+ verdict:
647
+ type: object
648
+ properties:
649
+ inputGranularity:
650
+ $ref: "#/components/schemas/Granularity"
651
+ validationGranularity:
652
+ $ref: "#/components/schemas/Granularity"
653
+ geocodeGranularity:
654
+ $ref: "#/components/schemas/Granularity"
655
+ addressComplete:
656
+ type: boolean
657
+ hasUnconfirmedComponents:
658
+ type: boolean
659
+ hasInferredComponents:
660
+ type: boolean
661
+ hasReplacedComponents:
662
+ type: boolean
663
+ hasSpellCorrectedComponents:
664
+ type: boolean
665
+ possibleNextAction:
666
+ type: string
667
+ enum: [POSSIBLE_NEXT_ACTION_UNSPECIFIED, FIX, CONFIRM_ADD_SUBPREMISES, CONFIRM, ACCEPT]
668
+ address:
669
+ type: object
670
+ properties:
671
+ formattedAddress:
672
+ type: string
673
+ postalAddress:
674
+ $ref: "#/components/schemas/PostalAddress"
675
+ addressComponents:
676
+ type: array
677
+ items:
678
+ $ref: "#/components/schemas/ValidationAddressComponent"
679
+ missingComponentTypes:
680
+ type: array
681
+ items:
682
+ type: string
683
+ unconfirmedComponentTypes:
684
+ type: array
685
+ items:
686
+ type: string
687
+ unresolvedTokens:
688
+ type: array
689
+ items:
690
+ type: string
691
+ geocode:
692
+ type: object
693
+ properties:
694
+ location:
695
+ type: object
696
+ properties:
697
+ latitude:
698
+ type: number
699
+ longitude:
700
+ type: number
701
+ placeId:
702
+ type: string
703
+ placeTypes:
704
+ type: array
705
+ items:
706
+ type: string
707
+ uspsData:
708
+ type: object
709
+ properties:
710
+ standardizedAddress:
711
+ type: object
712
+ properties:
713
+ firstAddressLine:
714
+ type: string
715
+ secondAddressLine:
716
+ type: string
717
+ cityStateZipAddressLine:
718
+ type: string
719
+ city:
720
+ type: string
721
+ state:
722
+ type: string
723
+ zipCode:
724
+ type: string
725
+ zipCodeExtension:
726
+ type: string
727
+ dpvConfirmation:
728
+ type: string
729
+ enum: [Y, N, S, D]
730
+ dpvFootnote:
731
+ type: string
732
+ postOfficeCity:
733
+ type: string
734
+ postOfficeState:
735
+ type: string
736
+ errorMessage:
737
+ type: string
738
+ cassProcessed:
739
+ type: boolean
740
+ ValidateAddressResponse:
741
+ type: object
742
+ required: [result, responseId]
743
+ properties:
744
+ result:
745
+ $ref: "#/components/schemas/ValidationResult"
746
+ responseId:
747
+ type: string