-
Notifications
You must be signed in to change notification settings - Fork 0
bodyTree vs contentTree #84
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
Comments
what if the entire response is the
|
After some discussion in the team around the two options, we’d prefer to go with option 1 — having one field for
|
I'd be okay with that, agree it will make the migration easier. Also I hadn't considered other content types @apaleslimghost's suggestion is interesting, but I think would only work if the new /content-tree api was just for content tree? Currently it's I guess an eventual replacement for /internalcontent - which means we'd have to add all the other fields (annotations, byline, whatever) into the schema. Maybe not a terrible thing?! But would be quite a change, and I dunno how it scales to other content types |
Content Tree
In Content Tree, we have represented the output as a single root node, which (for now) has a
body
property. The intention was to allow for further expansion as we model the rendering data for other parts of the article - such as toppers (#73), maybe other future things.The build currently outputs three different JSON schemas:
content-tree.schema.json
- this expects the Root node with allexternal
properties (e.g.ContentTree.full.Recommended
)transit-tree.schema.json
- this expects the Root node withoutexternal
properties (e.g.ContentTree.transit.Recommended
)body-tree.schema.json
- this expects the Body node withoutexternal
properties (e.g.ContentTree.transit.Recommended
)C&M representation
current state
Note
This section assumes a future
topper
is part of content-tree, to illustrate the point.Currently in C&M we have a
bodyTree
field that validates against thetransit-tree
schema. This means the data published would look like this:This is somewhat counter-intuitive to someone reading the API. It also means, if/when we add a
topper
to theroot
, this would need to appear inbodyTree
- which also wouldn't make sense.option 1
body
andtopper
propertiesbodyTree
field validates against thebody-tree
schematopperTree
field validates against a futuretopper-tree
schemaThis was our original intention when planning to bring content-tree into C&M. The intention was that
bodyTree
would be analogous tobodyXML
, which would lead to a more straightforward migration.topperTree
doesn't necessarily have an equivalent in the existing API, so does not have the same consideration. Keeping them as separate fields in C&M may also make things simpler for use cases where a consumer does not need the entire content (e.g. RSS feeds only need the body and wouldn't really need a topper)The downside is that the
content-tree
root becomes somewhat irrelevant, as nothing would use it in reality.It also means FT.com consumers need to validate multiple separate fields.
option 2
body
andtopper
propertiescontentTree
field validates against thetransit-tree
schemaUsers that require just the body would need to access
contentTree.body
This option does mean there is a clearer relationship between the content-tree spec and the C&M field. And that we don't need to generate separate schemas just for the body and topper.
It is perhaps slightly more involved for consumers expecting just one or the other, but maybe not in a bad way?
It also might be nicer if we for example have several other properties we might add to the root. An off-the-cuff example might be something like
colourScheme
orpageLayout
, which could be properties affecting both bodies and toppers. Having a single field means we don't need to add them individually to the C&M schema.The text was updated successfully, but these errors were encountered: