Skip to content

[BUG] Nested serializers don't return crossreferences field #953

@calumbell

Description

@calumbell

Description

I am currently working through a feature on the front-end that will use the crossreferences data structure (introduced #876) to create contextual links on the Open5e website. One feature that the API is lacking to fully support this is the ability for the CreatureAction serializer to return Crossreferences.

The specific use-case I am hoping to support with this change is to add links from Monster statblocks that include spell lists to pages on the Open5e site where the spells function is explained (they will also be used to generate helpful hover-over text).

It is technically possible to achieve this functionality with the code-base as is by creating crossreferenes from Creature data entries, but the lack of specificity wrt where in the statblock the crossreferences should be applied means that a whole bunch of unnecessary regex would be run.

EDIT. On closer investigation, this isn't only an issue which effects the CreatureActionSerializer, but with all nested serializers. Returning cross-references for the following nested serializers makes sense to me:

  • BackgroundBenefitSerializer (linking to recommended feats)
  • ClassFeatureSerializer (for linking to conditions and recommended feats)
  • SpeciesTraitSerializer (linking to Spells mentioned in species packages)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions