Closed
Description
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
[Resource]
public class User : Identifiable<long>
{
}
but if I do
POST http://localhost:5203/users
Content-Type: application/vnd.api+json
{
"data": {
"type": "users",
"id": "76561197960279927"
}
}
I'll get this error
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