Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Poker story objects in API have different syntax depending on endpoint #644

Open
1 task done
heinezen opened this issue Oct 30, 2024 · 4 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@heinezen
Copy link

Contact Details

No response

What happened?

I'm not sure if this is exactly a bug, but it's definitely annoying. Depending on which endpoint in the API is used, poker stories are expected to have a slightly different format. In my case, I was confused by the different schemas for poker stories used in the endpoints

  1. POST /users/{userId}/battles (creating a new poker game)
  2. POST /battles/{battleId}/plans (adding a poker story to a game)

The 1. endpoint expects the schema of the http.battleRequestBody object for the game, which refers to thunderdome.Story for the poker story object. 2. expects a different schema called http.planRequestBody.

Not only is the schema different, the naming of the fields in these schemas are also not consistent. For example, setting the poker story title in thunderdome.Story uses the field name, while it's planName in http.planRequestBody. There are also some fields that are not specified in the schema of http.planRequestBody but are apparently still parsed and processed, e.g. priority.

Self Hosted?

No

Version

Latest

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@heinezen heinezen added the bug Something isn't working label Oct 30, 2024
@StevenWeathers
Copy link
Owner

Thanks for pointing out these discrepancies, unfortunately without breaking the API I can't correct name differences, however I can add non required fields to the API docs.

@StevenWeathers
Copy link
Owner

StevenWeathers commented Oct 30, 2024

I've added priority to the story create request body, when I do a v5 I will try to reconcile name discrepancies.

@heinezen
Copy link
Author

I can understand that you don't want to break the API. Maybe it would be possible to check if the received JSON data contains unrecognized fields? I spent a mildly frustrating amount of time on figuring out why passing name to POST /battles/{battleId}/plans wouldn't set the title of the story correctly, only to find out later that planName was correct 😄 Pointing out that the data contains unrecognized fields may allow people to catch these problems sooner.

@StevenWeathers
Copy link
Owner

API Validation responses is something I do need to improve, it can be confusing which field failed validation currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants