Skip to content

getPost(bySlug:from:completion:) endpoint does not return collection alias #20

@AngeloStavrow

Description

@AngeloStavrow

This isn't exactly a bug — the Write.as/WriteFreely API doesn't return collection information on the GET /api/collections/{COLLECTION_ALIAS}/posts/{SLUG} endpoint (or GET /api/posts/{POST_ID}, for that matter), so technically this method on WFClient follows that behaviour.

It does, however, mean that you get back a WFPost whose collectionAlias property is nil — which is unexpected, given that you asked the API to fetch a post from some specific collection.

And so, I'm categorizing this as a bug: on success, the method should insert the collection alias that it was given back into the WFPost object that is returned to the completion handler.

Workaround: Don't overwrite the post's collection alias in your client's completion handler for this method (or, keep a reference to that collection alias, and re-insert it into your client's post type).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions