Skip to content

Add Message Data Model #195

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

Merged
merged 6 commits into from
Oct 12, 2021
Merged

Conversation

eemeli
Copy link
Collaborator

@eemeli eemeli commented Sep 11, 2021

As a first step in actually filling out the spec, here's my proposal for the Message data model.

This should be relatively uncontroversial, as we've previously agreed that messages may have top-level selectors. This data model is also as simple as possible, and does not e.g. allow for number values in selector keys. I'll later submit a PR for a selector algorithm that works with the proposed data model.

The definitions of PatternElement and Meta are left outside the scope of this PR.

As a stylistic choice, I've opted here to use normal text when referring to defined objects (which have a Capital first letter), but format their properties and methods as code. The types & interfaces use TypeScript for clarity.

@eemeli eemeli added the spec label Sep 11, 2021
Copy link
Contributor

@dminor dminor left a comment

Choose a reason for hiding this comment

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

Thank you, this seems like a good start to me.

Co-authored-by: Dan Minor <dminor@mozilla.com>
@eemeli eemeli requested a review from zbraniecki September 20, 2021 19:10
Copy link
Member

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

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

lgtm!

@eemeli
Copy link
Collaborator Author

eemeli commented Sep 23, 2021

Updated the proposal based on requests by @mihai, separating the abstract data type definitions of the interfaces from their canonical JSON equivalents as well as applying other requested changes, such as dropping references to metadata objects.

The proposed structure is now hopefully capable of reaching the appropriate level of abstraction, as we define nine types/interfaces instead of only five.

Copy link
Collaborator

@romulocintra romulocintra left a comment

Choose a reason for hiding this comment

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

Great Work!! Unique was what I comment on before about duplicating interfaces to have canonical JSON representation that I think we can think about in the future.

@eemeli eemeli requested a review from mihnita September 29, 2021 22:07
@eemeli
Copy link
Collaborator Author

eemeli commented Sep 29, 2021

@mihnita Do you have any remaining concerns about this PR?

Copy link
Collaborator

@mihnita mihnita left a comment

Choose a reason for hiding this comment

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

@mihnita Do you have any remaining concerns about this PR?

Sorry, yes.
I got hit (again) by the non-intuitive github UI.

I though I submitted the review, but I needed to look at the commit with Firefox and not logged-in to see that they are not actually pushed.
:-(

@nciric
Copy link

nciric commented Oct 4, 2021

This would be a great first PR where we can:

  1. Land it soon
  2. Define what a design doc is for this group
  3. Use the design doc to hammer out the 3 options @mihnita proposed above
  4. Amend the final spec with the final solution that came out from design doc

@eemeli eemeli mentioned this pull request Oct 11, 2021
@eemeli
Copy link
Collaborator Author

eemeli commented Oct 11, 2021

Updated the PR following discussions on today's brainstorming call, based on review comments from @mihnita and @stasm:

  • Added a note about the representation of fallback values still being under discussion.
  • Dropped the canonical JSON representations, which will need to be included elsewhere in the spec.

We further agreed on the call that @mihnita and @stasm will re-review this PR within the next 24h or so, allowing it to finally be merged.

@eemeli eemeli requested a review from mihnita October 11, 2021 18:13
Copy link
Collaborator

@stasm stasm left a comment

Choose a reason for hiding this comment

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

LGTM, great work @eemeli and others. The last time I looked at this was probably a month ago and I scribbled down some notes about dropping meta, JSON, type and a few others. I'm sorry that I didn't have time to participate more actively in the discussion in this PR. OTOH I see that other reviewers had similar comments; reviewing this today I don't have much to add. I think this PR represents a good starting point for future spec work.

Each of the SelectMessage `cases` is defined by a key of one or more string identifiers,
and selection between them is made according to the corresponding Selector values.
From this it follows that a valid SelectMessage must have at least as many `select` entries
as its highest count of string entries within the keys of its `cases`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

(Non-blocking) I'd suggest to drop the From this it follows... sentence. We'll need to figure this out anyways when specifying the case selection logic, and I don't know if such a requirement will be needed.

@romulocintra romulocintra merged commit 995cb0e into unicode-org:main Oct 12, 2021
@eemeli eemeli deleted the define-messages branch October 12, 2021 17:52
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.

7 participants