devvit icon indicating copy to clipboard operation
devvit copied to clipboard

getSubredditInfoByName's type property is returned in upper case, docs say it should be lower case

Open devvit-help-bot[bot] opened this issue 10 months ago • 1 comments

Details

There's an inconsistency between the value of the type property on the return values of getSubredditInfoByName vs getCurrentSubreddit.

getCurrentSubreddit returns the value in lower case, consistent with the [docs]https://developers.reddit.com/docs/api/redditapi/modules/models#subreddittype) for SubredditType, but getSubredditInfoByName returns it in upper case. E.g.

  const sub1 = await context.reddit.getCurrentSubreddit();
  const sub2 = await context.reddit.getSubredditInfoByName("unitedkingdom");
  console.log(sub1.type, sub2.type);

returns public PUBLIC, not public public as it should.

Additional info

Discord message: _There's an inconsistency between the value of the type property on the return values of getSubredditInfoByName vs getCurrentSubreddit.

getCurrentSubreddit returns the value in lower case, consistent with the [docs]https://developers.reddit.com/docs/api/redditapi/modules/models#subreddittype) for SubredditType, but getSubredditInfoByName returns it in upper case. E.g.

  const sub1 = await context.reddit.getCurrentSubreddit();
  const sub2 = await context.reddit.getSubredditInfoByName("unitedkingdom");
  console.log(sub1.type, sub2.type);

returns public PUBLIC, not public public as it should._

Message author: big.wheel

Discord link: https://discord.com/channels/1050224141732687912/1050227353311248404/1329736609725419573

devvit-help-bot[bot] avatar Feb 07 '25 02:02 devvit-help-bot[bot]

This should be resolved now by commit: https://github.com/reddit/devvit/commit/9b3073e9e5140232d54099c7129ef4a04c7e8f4b

slowcooked99 avatar Dec 09 '25 22:12 slowcooked99