Skip to content

Empty string ID is accepted in post resource request #1485

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

Closed
bkoelman opened this issue Feb 26, 2024 · 1 comment · Fixed by #1593
Closed

Empty string ID is accepted in post resource request #1485

bkoelman opened this issue Feb 26, 2024 · 1 comment · Fixed by #1593

Comments

@bkoelman
Copy link
Member

bkoelman commented Feb 26, 2024

{
    Data = new PlayerDataInPostRequest
    {
        Id = null!, // FIXME: passing "" here works fine 🤔
    }
}

Originally posted by @verdie-g in #1475 (comment)


Interesting! I've debugged it down to RuntimeTypeConverter, which returns the target type's default value for an empty string. And there are tests for that behavior. However, I have no idea why it works like that. It was introduced in #139, all the way back in 2017.

When removing that behavior, all the tests are still green. However this is a very risky thing to change.

@maurei does this ring any bells? What's happening here is that a client sends "data": { "id": "", ... } in a post resource request, with the configuration that client-generated IDs are required.

Originally posted by @bkoelman in #1475 (comment)


Read into it a little bit. It sounds familiar for sure, but it doesn't really ring a concrete bell at this moment... 🤷

Originally posted by @maurei in #1475 (comment)

@bkoelman
Copy link
Member Author

I'm afraid this bug has become a "feature", ie people may be relying on the current behavior and we shouldn't break them in a minor or patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant