Skip to content

Add ability to filter monsters by environment#884

Merged
calumbell merged 1 commit intoopen5e:stagingfrom
stevennoto:stevennoto-add-monsters-environments-filter
Feb 26, 2026
Merged

Add ability to filter monsters by environment#884
calumbell merged 1 commit intoopen5e:stagingfrom
stevennoto:stevennoto-add-monsters-environments-filter

Conversation

@stevennoto
Copy link
Contributor

This PR adds a filter to monsters on the field environments_json. It enabled filtering monsters by their environment.

Example API call now possible: /v1/monsters/?limit=50&type=Dragon&environments=Mountain

The filter uses simple substring matching, since the environments json data includes simple strings with some inconsistencies.

Copy link
Contributor

@calumbell calumbell left a comment

Choose a reason for hiding this comment

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

Hi @stevennoto, thanks for your contribution! I have tested this out on my local Django development server and all appears to be functioning as intended.

And thanks for fixing that deadlink in the README! I shudder to think how long that has been there for...

I'll approve and get this merged to staging

@calumbell calumbell merged commit 87f5e53 into open5e:staging Feb 26, 2026
3 checks passed
@stevennoto
Copy link
Contributor Author

Thank you @calumbell for the fast review and merge, that's awesome!

Do you know if any changes to the website would be needed to expose the new filter at https://open5e.com/monsters ? If so, let me know, and I can take a look. Thanks!

@calumbell
Copy link
Contributor

Happy to help @stevennoto, thanks for contributing!

On the topic of changes we'd need to see to expose the filter on the front-end, there is a little complexity to explain:

There are currently two versions of the Open5e API: V1 and V2. The current website uses V1, but we have been working on migrating both the front- and back-end to V2 for a while now. We are at the finishing touches, polishing phases. Release is Very Soon (TM). The most up-to-date version of the Open5e site (which can be found here: https://beta.open5e.com/) uses the new V2 API exclusively. This will overwhelmingly likely be our next cut to production.

Your PR added the new filtering options to the V1 version of the API, which we plan to maintain for legacy purposes, but we won't be using on our live site anymore. So, to answer your question, to support filtering monsters by environment on the website we'll need to update the V2 filters (likely a very small change).

Feel free to open an issue, take a stab at it yourself if you have the bandwidth!

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.

2 participants