You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HTTP/1.1 403 Forbidden
Content-Type: application/vnd.api+json
Date: Fri, 18 Aug 2023 20:07:58 GMT
Server: Kestrel
Transfer-Encoding: chunked
{
"links": {
"self": "http://localhost:5203/users"
},
"errors": [
{
"id": "31676f4a-725e-44a3-9bd7-8013c0cf2f88",
"status": "403",
"title": "Failed to deserialize request body: The use of client-generated IDs is disabled.",
"source": {
"pointer": "/data/id"
}
}
]
}
I could use the option AllowClientGeneratedIds but it's applied to all resources and I only want it scoped to the user resource.
Describe the solution you'd like
- [Resource]+ [Resource(AllowClientGeneratedIds = true)]
public class User : Identifiable<long>
{
}
Describe alternatives you've considered
Define the steam id as an attribute but every time a steam id is mentioned in-game, I would have to do the mapping to my internal id to understand which users we're talking about
The text was updated successfully, but these errors were encountered:
I always wondered why this was only possible globally, and why nobody ever asked for this. It's a legitimate ask, I'm just not sure yet how to best provide that. Probably needs to be stored in the resource graph, settable by an attribute parameter.
Until this is implemented, it would be easiest for you to define a generic resource definition class and register it with open generics. Override the OnPrepareWriteAsync method, checking for the endpoint kind (post) and resource type (user), otherwise throwing when Id is non-default. I'm on vacation right now, so can't provide working code.
Is your feature request related to a problem? Please describe.
I would like to create a user for a steam game and reuse their steam id as the user id in my database.
The user is defined as
but if I do
I'll get this error
I could use the option
AllowClientGeneratedIds
but it's applied to all resources and I only want it scoped to the user resource.Describe the solution you'd like
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: