Shields: The stack exchange badge monthly questions returns invalid when query has 0 questions

Created on 12 May 2019  路  5Comments  路  Source: badges/shields

When I click on the default momentjs badge it is broken. When I choose another tag like go, it does not work as well.

https://shields.io/category/chat

Stack Exchange monthly questions: | 聽 | https://img.shields.io/stackexchange/stackoverflow/qm/momentjs.svg
-- | -- | --
聽 | https://img.shields.io/stackexchange/stackoverflow/r/123.svg
聽 | https://img.shields.io/stackexchange/stackoverflow/t/gson.svg

When one clicks on one of the links, it returns: stackoverflowstackoverflowinvalidinvalid

broken badge
go badge
golang badge
broken badge
broken badge
broken badge
broken badge
bcbsn badge

The number of questions per month badge does not seem to work as expected:

DevOps SE Monthly Questions

Expectation

  • devops should be included in the badge instead of stackoverflow
  • the response should not be invalid
bug service-badge

Most helpful comment

This looks like a schema bug to me so I'm going to update the schema accordingly

All 5 comments

Hi @030

It seems to me that the only badge not working is with the query bcbsn, as all the other badges you've listed are rendering. The reason those last two badges (both with the bcbsn query) have the stackoverflow label is because that's the default label that is still being used due to the invalid response data error.

We'll have to look into why we're getting that error for the bcbsn query

Okay I've found the problem. The API response is showing that there were 0 questions last month for the bcbsn query on the devops site:
https://api.stackexchange.com/2.2/questions?site=devops&tagged=bcbsn&filter=total&fromdate=1554094800&todate=1556686799

{
  "total": 0
}

But our schema validation is requiring that total be at least 1:
https://github.com/badges/shields/blob/master/services/stackexchange/stackexchange-monthlyquestions.service.js#L10

Since the bcbsn query has a value of 0, our schema is rejecting it, hence the invalid response data error.

I'll have to do some digging to determine why our schema is structured this way, whether it's a bug or intentional, etc.

This looks like a schema bug to me so I'm going to update the schema accordingly

Oh now they all seem to be broken

stackexchange-badge-bug

@030 the original issue (invalid response data on queries with 0 questions) has been fixed and should be deployed before too long.

I'm not sure what's going on with the embedded badges here, but the badges are rendering fine for me elsewhere. I believe the issues here are spurious but if you experience the invalid issue elsewhere I'd suggest opening a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

najeeb-ur-rehman picture najeeb-ur-rehman  路  3Comments

paulmelnikow picture paulmelnikow  路  3Comments

Turnerj picture Turnerj  路  3Comments

salaros picture salaros  路  3Comments

rominf picture rominf  路  3Comments