Skip to content
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 list element #233

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object CirceDecoders {
implicit val assetDecoder = Decoder[Asset]
implicit val elementDecoder = Decoder[Element]
implicit val referenceDecoder = Decoder[Reference]
implicit val blockElementDecoder = Decoder[BlockElement]
implicit val blockElementDecoder: Decoder[BlockElement] = shapeless.cachedImplicit
implicit val blockDecoder = Decoder[Block]
implicit val blocksDecoder = genBlocksDecoder
implicit val rightsDecoder = Decoder[Rights]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ object CirceEncoders {
Json.fromFields(fields)
}

implicit val blockElementEncoder: Encoder[BlockElement] = shapeless.cachedImplicit
implicit val networkFrontEncoder = Encoder[NetworkFront]
implicit val dateTimeEncoder = genDateTimeEncoder()
implicit val dateTimeEncoder: Encoder[CapiDateTime] = genDateTimeEncoder()
implicit val contentFieldsEncoder = Encoder[ContentFields]
implicit val editionEncoder = Encoder[Edition]
implicit val sponsorshipEncoder = Encoder[Sponsorship]
Expand Down
24 changes: 24 additions & 0 deletions models/src/main/thrift/content/v1.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ enum ElementType {
CARTOON = 21

RECIPE = 22

LIST = 23
}

enum TagType {
Expand Down Expand Up @@ -869,6 +871,26 @@ struct RecipeElementFields {
1: optional string recipeJson;
}

enum ListType {
KEY_TAKEAWAYS = 1,
Q_AND_A_EXPLAINER = 2,
}

struct ListItem {

1: required list<BlockElement> elements = [];

2: optional string title;

}

struct ListElementFields {

1: required list<ListItem> items;

2: optional ListType type;
}

struct BlockElement {

1: required ElementType type
Expand Down Expand Up @@ -925,6 +947,8 @@ struct BlockElement {
24: optional CartoonElementFields cartoonTypeData

25: optional RecipeElementFields recipeTypeData

26: optional ListElementFields listTypeData
}

struct MembershipPlaceholder {
Expand Down
Loading