unsplash / unsplash-photopicker-ios

📱An iOS photo picker to search and download photos from Unsplash.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SERVER ERROR DUE TO SCHEMA CHANGE

WiesnerPeti opened this issue · comments

Since today we are receiving Server Error when our users open the Unplashphoto picker modal. This is because the server returns the Unsplash.links dictionary in a new form for the getCollection requests. (Not for every but for some photos), The Codable decoding fails, as alternative_html is a dictionary instead of the URL.

Can you @ocollet please as a first reach out to the server team to revert any change that is causing this? Then a second update the Unsplasphoto model not to accept dictionary bot specific models? :)

Client code

public enum LinkKind: String, Codable {
        case own = "self"
        case html
        case download
        case downloadLocation = "download_location"
    }

public let links: [LinkKind: URL]

Server response of the dictionary

"links":
        {
            "self": "https://api.unsplash.com/photos/a-mountain-range-covered-in-snow-with-mountains-in-the-background--Sqw0ZRsdh8",
            "html": "https://unsplash.com/photos/a-mountain-range-covered-in-snow-with-mountains-in-the-background--Sqw0ZRsdh8",
            "alternative_html":
            {
                "en": "https://unsplash.com/photos/a-mountain-range-covered-in-snow-with-mountains-in-the-background--Sqw0ZRsdh8",
                "es": "https://unsplash.com/es/fotos/una-cadena-montanosa-cubierta-de-nieve-con-montanas-al-fondo--Sqw0ZRsdh8",
                "ja": "https://unsplash.com/ja/%E5%86%99%E7%9C%9F/%E9%9B%AA%E3%81%AB%E8%A6%86%E3%82%8F%E3%82%8C%E3%81%9F%E5%B1%B1%E8%84%88%E3%82%92%E8%83%8C%E6%99%AF%E3%81%AB%E5%B1%B1%E3%80%85--Sqw0ZRsdh8",
                "fr": "https://unsplash.com/fr/photos/une-chaine-de-montagnes-recouverte-de-neige-avec-des-montagnes-en-arriere-plan--Sqw0ZRsdh8",
                "it": "https://unsplash.com/it/foto/una-catena-montuosa-coperta-di-neve-con-montagne-sullo-sfondo--Sqw0ZRsdh8",
                "ko": "https://unsplash.com/ko/%EC%82%AC%EC%A7%84/%EC%82%B0%EC%9D%84-%EB%B0%B0%EA%B2%BD%EC%9C%BC%EB%A1%9C-%EB%88%88%EC%9C%BC%EB%A1%9C-%EB%8D%AE%EC%9D%B8-%EC%82%B0%EB%A7%A5--Sqw0ZRsdh8",
                "de": "https://unsplash.com/de/fotos/eine-schneebedeckte-bergkette-mit-bergen-im-hintergrund--Sqw0ZRsdh8",
                "pt": "https://unsplash.com/pt-br/fotografias/uma-cordilheira-coberta-de-neve-com-montanhas-ao-fundo--Sqw0ZRsdh8"
            },
            "download": "https://unsplash.com/photos/-Sqw0ZRsdh8/download?ixid=M3wxNDIyNzR8MHwxfGNvbGxlY3Rpb258Mjl8MzE3MDk5fHx8fHwyfHwxNzA5ODE5MzY1fA",
            "download_location": "https://api.unsplash.com/photos/-Sqw0ZRsdh8/download?ixid=M3wxNDIyNzR8MHwxfGNvbGxlY3Rpb258Mjl8MzE3MDk5fHx8fHwyfHwxNzA5ODE5MzY1fA"
        },

@WiesnerPeti Sorry about that! We accidentally pushed a breaking change to the API. Can you email me at olivier@unsplash.com so I can help you resolve the issue?

@ocollet Thank you for the answer, we are fixing this by forking the repo and changing the Unsplash codeable interface.

Do you know an eta when the change will be reverted?

We expect everything will get back to normal tomorrow.

The issue has been resolved by the API team. Closing this.