-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Rewrite the [DynamicJson] badge; affects [gitlab dynamic-xml dynamic-yaml] #2399
Conversation
Generated by 🚫 dangerJS |
I've found another case where the coupling of the request logic to the base class is causing problems. #1721 is about using github auth on a particular request, but only when static auth is present (i.e. for self-hosting). So I want the logic from If these functions were extracted to separate modules, it might leave open more options open for handling this unusual case. |
value: 'gh-badges', | ||
colorB: colorsB.brightgreen, | ||
value: 'shields.io', | ||
colorB: 'lightgreen', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the previous value was right. This PR changes the default to
- https://shields-staging-pr-2399.herokuapp.com/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=package&query=$.name
but I think we still want it to be
- https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=package&query=$.name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Thanks for catching that.
so that is what causes: - https://shields-staging-pr-2399.herokuapp.com/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.jso&label=package&query=$.name&colorB=blue instead of - https://shields-staging-pr-2399.herokuapp.com/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.jso&label=package&query=$.name right? Have you have any thoughts on how we might solve that? (if its large, it doesn't necessarily have to go into this PR) |
Yes, exactly right.
I suppose we'll need to add an Lines 392 to 437 in 8070f0b
I'd like to fix this, though it's a bit fiddly. There are possible merge conflicts to contend with in The test I disabled here really belongs in |
Gitlab failure seems transient. |
Hrm. On reflection, I think with crates what I did in PR #2462 was not the best way to do it. Perhaps that case would be better handled by throwing a custom shields/services/cdnjs/cdnjs.service.js Lines 29 to 33 in b2d5d3e
If we say we should always be throwing an exception for cases like this, would that allow us to handle this issue one layer further out (where we catch the exceptions and wrap them in a badge)?
Agreed - its just useful to think about how to do that, given its a bit fiddly |
We apply overrides further out than handling errors, which probably makes sense… since on error we should still respect e.g. Custom Probably we could catch Lines 330 to 332 in b2d5d3e
|
This starts the rewrite of the dynamic badges. I've pulled into BaseService an initial version of the query param validation from #2325.
I've extended from BaseJsonService to avoid duplicating the deserialization logic, though it means there is a bit of duplicated code among the three dynamic services. The way to unravel this would be to move the logic from
_requestJson
and friends from the base classes into functions so DynamicJson can inherit from BaseDynamic. Would that be worth it?Marked blocker since it affects other code that may validate query parameters (e.g. #2377), the other dynamic badges, and further cleanup of
server.js
.This introduces a regression of #1446 for this badge.
Ref: #2345 (partial fix)