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

Bring serviceData and makeBadge schemas into full alignment #3370

Open
paulmelnikow opened this issue Apr 27, 2019 · 0 comments
Open

Bring serviceData and makeBadge schemas into full alignment #3370

paulmelnikow opened this issue Apr 27, 2019 · 0 comments
Labels
core Server, BaseService, GitHub auth npm-package Badge generation and badge templates

Comments

@paulmelnikow
Copy link
Member

Since #2863 is done, the schema translation being performed in coalesceBadge() is no longer useful. If we bring the makeBadge() schema into full alignment with serviceData, we won't need to translate schema in coalesceBadge().

The function would still exist, but it would only coalesce, not also translate schema.

This is dependent on resolving named icons within makeBadge() and making simple-icons an optional dependency.

This work is related to #3369, though separable.

@paulmelnikow paulmelnikow added core Server, BaseService, GitHub auth npm-package Badge generation and badge templates labels Apr 27, 2019
paulmelnikow added a commit that referenced this issue Oct 16, 2020
…`makeBadge()`

Part of #3370, and also helps with #4950.

This is cherry-picked from #4980 but stops short of the mor substantive changes of that PR.

Also rewrites most of the tests of `coalesceBadge()` to use `.includes()`, providing IMO a slight improvement in readability.
paulmelnikow added a commit that referenced this issue Oct 16, 2020
…`makeBadge()` (#5719)

There is an internal `makeBadge()` function which is called from a few places in the server and from the public `makeBadge()` function which is a light wrapper. (Eventually we want to dogfood the public API: that's the work of #4950, and this helps with it by aligning the interfaces.)

Related to that is #3370, which is about aligning the `serviceData` schema (i.e. the result of `handle()`) with the public `makeBadge()` function.

A legacy quirk of the _private_ `makeBadge()` function is accepting a `text: ['label', 'message']` array instead of separate `{ label, message }` props like the rest of the codebase. `coalesceBadge()` has to translate from `{ label, message }` to `text: ['label', message']`. This removes that bit of indirection.

It also rewrites most of the tests of `coalesceBadge()` to use `.includes()`, providing IMO a slight improvement in readability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth npm-package Badge generation and badge templates
Projects
None yet
Development

No branches or pull requests

1 participant