Skip to content

Conversation

@calumbell
Copy link
Contributor

Description

This PR fixes a bug on the /classes endpoint where ClassFeatures that contained both tabular and non-tabular data would only return the tabular data.

The example used in the issue that this closes was the WOTC SRD Rogue’s Sneak Attack feature, should contains both ”table_data” to display in the Class Table (a column showing much damage sneak attack deals at each level), and “gained_at” information (which levels a feature is gained at).

Previously, the API would only return one or the other. Now it can return both:

/v2/classes/srd_rogue

"gained_at": [
  {
    "level": 1,
    "detail": null
  }
],
"table_data": [
  {
    "level": 1,
    "column_value": "1d6"
  },
  {
    "level": 10,
     "column_value": "5d6"
  },
  ...
]

This fix was made by updating the logic that seperated “gained_at” and “table_data” on the ClassFeature serializer to handle the edge-case where a feature appears a both a table column and a feature in the body text (Rogue’s Sneak Attack, and Monk’s Martial Arts and Unarmored Movement are all examples of this.

Related Issue

Closes #651

How has this been tested

The feature was principally tested using A/B testing between the feature and staging branches to make sure that it is working as intended. The /v2/classes/srd_rogue endpoint was visited on both branches and the JSON payload compared.

Pytest was also run to make sure that there were no unintended consequences to this fix. No tests needed to be updated.

@augustjohnson
Copy link
Collaborator

Oh man, yeah this is a good catch.

@calumbell calumbell merged commit d55c393 into open5e:staging Apr 14, 2025
3 checks passed
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.

V2: SRD Rogue "Sneak Attack" missing "gained_at" information

2 participants