Skip to content

[BUGFIX] GameContentSerializer now inherits from ModelSerializer#899

Open
calumbell wants to merge 4 commits intoopen5e:stagingfrom
calumbell:897/serializer-refactor
Open

[BUGFIX] GameContentSerializer now inherits from ModelSerializer#899
calumbell wants to merge 4 commits intoopen5e:stagingfrom
calumbell:897/serializer-refactor

Conversation

@calumbell
Copy link
Contributor

Description

This PR fixes an issue where unnecessary URLs were being generated for some of our find many endpoints (ie. fetching 50 Creatures caused about 600 calls to url() according to cProfile) taking up a significant amount of server time.

The issue was there GameContentSerializer, the abstract class inherited by the vast majority of our Serializers, inherited from the HyperlinkedModelSerializer, which always generates a URL when it is called, whether or not the serializer even returns a URL, or if it makes sense for it to!

The fix involved the following steps:

  1. Replace HyperlinkedModelSerializer with ModelSerializer in GameContentSerializer's inheritance chain
  2. Remove "url" from the "fields" array in serializers that inherit from GameContentSerializer.
  3. Update our test suite to account for the removal of the "url" field from many serializers

Related Issue

Closes #896

How was this tested?

  • Spot checked on local Django development server
  • pytest (all tests passing, once cases updated to reflect new shape of API response)

@calumbell
Copy link
Contributor Author

Closing and re-opening to re-run PR validation

@calumbell calumbell closed this Mar 20, 2026
@calumbell calumbell reopened this Mar 20, 2026
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.

[BUG / PERFORMANCE] slow Sumary serializers generating unnecessary URLs

1 participant