From 8083ea6687756e5d3006db8eb3caec5a19cb04ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Charvet=20=E9=BB=91=E7=93=9C?= Date: Mon, 18 Nov 2024 21:15:13 +0000 Subject: [PATCH] Remove formating constraint on user id (#37) No need to require a UUID, it's treated as an opaque string --- docs/schema/autohost.md | 8 ++++---- docs/schema/user.md | 11 ++++------- schema/compiled.json | 11 ++--------- schema/definitions/userId.json | 3 +-- schema/user/updated/event.json | 5 +---- src/schema/definitions/userId.ts | 3 +-- 6 files changed, 13 insertions(+), 28 deletions(-) diff --git a/docs/schema/autohost.md b/docs/schema/autohost.md index 07dcfd1..b9b28dd 100644 --- a/docs/schema/autohost.md +++ b/docs/schema/autohost.md @@ -114,7 +114,7 @@ Request to add a new player to the battle. "commandId": "autohost/addPlayer", "data": { "battleId": "00000000-0000-0000-0000-000000000000", - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e", + "userId": "351", "name": "ipsum", "password": "ipsum" } @@ -269,7 +269,7 @@ Kick a player from a battle. "commandId": "autohost/kickPlayer", "data": { "battleId": "00000000-0000-0000-0000-000000000000", - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e" + "userId": "351" } } ``` @@ -568,7 +568,7 @@ Mute a player in a battle. "commandId": "autohost/mutePlayer", "data": { "battleId": "11111111-1111-1111-1111-111111111111", - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e", + "userId": "351", "chat": false, "draw": false } @@ -1027,7 +1027,7 @@ Force players to become spectators in a battle. "data": { "battleId": "22222222-2222-2222-2222-222222222222", "userIds": [ - "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e" + "351" ] } } diff --git a/docs/schema/user.md b/docs/schema/user.md index d4f005d..8fba3c9 100644 --- a/docs/schema/user.md +++ b/docs/schema/user.md @@ -46,10 +46,7 @@ Sent by the server to inform the client when subscribed users get updated in som "properties": { "userId": { "type": "string", - "format": "uuid", - "examples": [ - "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e" - ] + "examples": ["351"] }, "username": { "type": "string" }, "displayName": { "type": "string" }, @@ -126,7 +123,7 @@ Sent by the server to inform the client when subscribed users get updated in som "users": [ { "occaecatff": -19999999.999999955, - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e", + "userId": "351", "username": "occaecat Lorem in", "scopes": [ "occaecat Lorem in", @@ -143,7 +140,7 @@ Sent by the server to inform the client when subscribed users get updated in som }, { "occaecatff": -19999999.999999955, - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e", + "userId": "351", "username": "occaecat Lorem in", "scopes": [ "occaecat Lorem in", @@ -160,7 +157,7 @@ Sent by the server to inform the client when subscribed users get updated in som }, { "occaecatff": -19999999.999999955, - "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e", + "userId": "351", "username": "occaecat Lorem in", "scopes": [ "occaecat Lorem in", diff --git a/schema/compiled.json b/schema/compiled.json index ba2b1a8..8342cb9 100644 --- a/schema/compiled.json +++ b/schema/compiled.json @@ -180,11 +180,7 @@ "status" ] }, - "userId": { - "type": "string", - "format": "uuid", - "examples": ["f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e"] - } + "userId": { "type": "string", "examples": ["351"] } }, "anyOf": [ { @@ -1860,10 +1856,7 @@ "properties": { "userId": { "type": "string", - "format": "uuid", - "examples": [ - "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e" - ] + "examples": ["351"] }, "username": { "type": "string" }, "displayName": { "type": "string" }, diff --git a/schema/definitions/userId.json b/schema/definitions/userId.json index 5649c45..4389368 100644 --- a/schema/definitions/userId.json +++ b/schema/definitions/userId.json @@ -2,6 +2,5 @@ "$id": "https://schema.beyondallreason.dev/tachyon/definitions/userId.json", "title": "UserId", "type": "string", - "format": "uuid", - "examples": ["f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e"] + "examples": ["351"] } diff --git a/schema/user/updated/event.json b/schema/user/updated/event.json index 0d723b1..c92ce3e 100644 --- a/schema/user/updated/event.json +++ b/schema/user/updated/event.json @@ -26,10 +26,7 @@ "properties": { "userId": { "type": "string", - "format": "uuid", - "examples": [ - "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e" - ] + "examples": ["351"] }, "username": { "type": "string" }, "displayName": { "type": "string" }, diff --git a/src/schema/definitions/userId.ts b/src/schema/definitions/userId.ts index 188e75f..91eaf53 100644 --- a/src/schema/definitions/userId.ts +++ b/src/schema/definitions/userId.ts @@ -2,6 +2,5 @@ import { Type } from "@sinclair/typebox"; export const userId = Type.String({ $id: "userId", - format: "uuid", - examples: ["f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e"], + examples: ["351"], });