-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add ?formats param to Posts API #8305
Conversation
This works pretty good already. Thanks for pre-work 🙃
Agree, i can see what you mean. A tag doesn't contain a huge data set, just some short strings. Something we can improve in the future, but i wouldn't raise an issue out of it. Let me know if you would like to 👍 |
bd92417
to
14444b8
Compare
refs TryGhost#8275 - Adds support for formats param - Returns html by default - Can optionally return other formats by providing a comma-separated list
refs TryGhost#718, TryGhost/Ghost#8305 - meta description preview in the PSM was relying on the `html` field which is no longer queried - see TryGhost#718 and TryGhost/Ghost#8305 - restores live preview that was in LTS but removed whilst implementing mobiledoc because we had no quick way of rendering mobiledoc->text - adds a boolean argument to the `formatMarkdown` util that can disable the replacement of `<script>` and `<iframe>` tags so that the inserted text isn't rendered when converting HTML to text
refs TryGhost#718, TryGhost/Ghost#8305 - meta description preview in the PSM was relying on the `html` field which is no longer queried - see TryGhost#718 and TryGhost/Ghost#8305 - restores live preview that was in LTS but removed whilst implementing mobiledoc because we had no quick way of rendering mobiledoc->text - adds a boolean argument to the `formatMarkdown` util that can disable the replacement of `<script>` and `<iframe>` tags so that the inserted text isn't rendered when converting HTML to text
refs #718, refs TryGhost/Ghost#8305 - meta description preview in the PSM was relying on the `html` field which is no longer queried - see #718 and TryGhost/Ghost#8305 - restores live preview that was in LTS but removed whilst implementing mobiledoc because we had no quick way of rendering mobiledoc->text - adds a boolean argument to the `formatMarkdown` util that can disable the replacement of `<script>` and `<iframe>` tags so that the inserted text isn't rendered when converting HTML to text
This PR is a bit weird, and very lacking in tests.
I'm not particularly happy with the implementation - there's duplication of the properties at the API and model layer. I think this is a symptom of a much larger problem with regard to separation of concerns between the model & API layer - and one that's not worth fixing right now.
Note: I've implemented this such that if you did something like:
/posts/?formats=mobiledoc,html&fields=id,title
You'd get all 4 fields returned, and don't have to specify the formats in both formats and fields. This is a little bit inconsistent with what happens if you did:
/posts/?include=tags&fields=id,title
Where you'd only get the id and title fields, despite having requested tags.
I thought about this, and came to the conclusion that the concepts are different enough that it makes sense. Having to duplicate formats in a fields request is weird because they're both column names.
However,
include=tags
represents a whole object, not just a single field, and so eventually we want to be able to support something like/posts/?include=tags&fields=id,title,tag.name
or
/posts/?include=tags&fields=id,title,tag.*
refs #8275
TODO:
formats
query param Admin#718)