chrisdhaan / CDYelpFusionKit

An extensive Swift wrapper for the Yelp Fusion API.
MIT License
54 stars 18 forks source link

Food Trucks Come Back in Invalid Format #32

Closed Mcrich23 closed 2 years ago

Mcrich23 commented 2 years ago

What did you do?

I tried to search for Food Trucks by using seachBusinesses(byTerm: "Food Trucks", ...) and also trying using seachBusinesses(byTerm: "", ..., categories [.foodTrucks], ...)

What did you expect to happen?

It to fetch correctly

What happened instead?

It came back with an error saying that it was unable to decode, because it was an invalid format.

CDYelpFusionKit Environment

CDYelpFusionKit version: 3.0.0
Xcode version: 13.2.1
Swift version: 5.5
Platform(s) running CDYelpFusionKit: iOS, iPadOS
macOS version running Xcode: 12.3 beta

Demo Project

https://drive.google.com/file/d/1CJwc-CND6TY_4-auPCd7GU_hQTbK9XMw/

davecom commented 2 years ago

FWIW I'm seeing something similar when searching particular categories of restaurants and also when searching by closest distance. I'm investigating it further too to see exactly where the mismatch is for decoding.

davecom commented 2 years ago

I've found that the problem has to do with the decoding of image_url. I had to make a change to CDYelpBusiness: public let imageUrl: URL? became public let imageUrl: String?

This seems to be because it can't decode it into a URL when the JSON response has "" for image_url.

Mcrich23 commented 2 years ago

Thx

chrisdhaan commented 2 years ago

Thanks for bringing this up @Mcrich23 . And thanks for opening a PR @davecom . Sorry about the slow response. I'll take a look this week.

chrisdhaan commented 2 years ago

@Mcrich23 @davecom this should be fixed with 3.2.0. Can you confirm?

Mcrich23 commented 2 years ago

It works!!!! @chrisdhaan

chrisdhaan commented 2 years ago

Thanks for confirming. Closing since #36 addressed this issue.