By YiyaoPublished
Generate one identifier for an independent record
Select Generate UUID v4 to make an identifier for a test fixture or a new record. Copy the complete value, including its hyphens, into the destination field. If the receiving system specifies a different UUID version, use its supported method rather than altering a v4 string by hand.
Check the visible structure
The example 550e8400-e29b-41d4-a716-446655440000 has groups of 8, 4, 4, 4 and 12 hexadecimal characters. The third group starts with 4, which marks version 4. For the variant used here, the fourth group starts with 8, 9, a or b. This example is a fixed illustration, not a value to reuse across new records.
Decide when to keep or regenerate the value
| Situation | Action |
|---|---|
| Creating a separate fixture | Generate a new UUID and check the destination accepts it |
| Retrying an import of the same record | Preserve the original identity according to the import contract |
| The input requires a database-issued ID | Use the database or application workflow; don't substitute a UUID |
| You need a password-reset or access token | Use the application's dedicated token mechanism |
Before you generate an ID, check which ID field the receiving system expects.
Check the imported record
For three synthetic records, generate three values and assign one to each at creation. Export them, then read the export back and compare the exact strings used by the receiving system. Count distinct IDs separately from row count. If three rows have only two IDs, check whether the duplicate is an intended reference or two records incorrectly sharing one identifier.
Questions about generated UUIDs
Does correct syntax prove an ID is new to my system? No. Keep the database's identity and uniqueness checks.
Should I use the example in production? No. Use the example for checking shape, not as a new production identity.
Use the generated value in an approved test record
Generate, copy and verify the value in a test environment. Keep identifiers distinct from authorization, and keep an existing value when the workflow requires stable identity.
