Skip to content

wip: add demo topper definition #73

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

wip: add demo topper definition #73

wants to merge 2 commits into from

Conversation

adgad
Copy link
Collaborator

@adgad adgad commented Apr 1, 2025

What is this?

This draft PR is a loose implementation of what a topperTree could look like. Ignore the details - it's mostly a place to start the conversation about feasibility and desirability.

Why do I think it's desirable?

bodyTree has served us well for creating a common and consistent language to describe the full representation of an article body, and the data required for it.

Toppers do not have the same luxury - the structure of a topper (in Spark/C&M) has been largely unchanged since 2017. Data in C&M lives in a bunch of fields: core fields like headline, standfirst, some things in topper, leadImages, leadFlourish. There's also a lot hidden of inferred decisions made in business logic in CP.

We're now looking to add (clips and/or custom components) to toppers, and it seems like a nice opportunity to start thinking about whether we can apply some of the same thinking and reap the same benefits with toppers, to result in a more consistent, reusable data models.

How will it work (in theory)?

  1. We define a topperTree data structure
  2. Update cp-content-pipeline-api to start using that
  3. (Extract some shared business logic out of CP content pipeline so it can be used in Spark)
  4. Spark generates and publishes the topperTree transit data structure to C&M
  5. C&M validate the data structure using JSON schemas generated in this repo
  6. CP start reading the topperTree data structure from the new C&M read API (which we'll also be doing for bodyTree)

What are some of the questions/challenges?

  • What do we do about fields that are inferred from other content things (e.g. metadata)? Does external still make sense?
  • We have some things that are editorially published, but possibly later overridden (e.g. backgroundColor)
  • To what extent does this fit with existing topper implementations?
  • What about old content? Would we need to migrate anything??
  • What can we simplify to make it work better? e.g. can we move some decisions to more explicit editorial ones?
  • To what extent could we implement this incrementally (in particular to get a working clip/ccc in topper)?
    • We would b
  • (related) is it possible to "virtually" build out the topperTree, without publishing, to iron out the model?

README.md Outdated
type: 'topper'
topperType: TopperType
backgroundColor: string // maybe a type? is this external??
children: [Headline, Intro, TopperVisual?]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these be keys rather than children? allows for further growth?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it does make sense.

the benefit of having them as children i guess would be if there wasn't a regimented structure, and the FE could receive/render anything (like we do with RichText).

this probably isn't true for the topper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant