platformplatform / PlatformPlatform

Alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
https://platformplatform.github.io
MIT License
253 stars 26 forks source link

Support sending and receiving strongly typed IDs as strings in REST endpoints #611

Closed tjementum closed 2 weeks ago

tjementum commented 2 weeks ago

Summary & Motivation

Update REST endpoints to support sending and receiving strongly typed IDs as strings in JSON request bodies and responses. Previously, strongly typed IDs were only supported on endpoint routes, like group.MapGet("/{id}", (UserId id) => { });.

In JSON request and response bodies, they were sent in an object format:

"id": {
  "value": "usr_01JBQ59BD2SMRX0HQN7FTJM7F8"
}

With this update, strongly typed IDs can now be represented as simple strings in JSON:

"id": "usr_01JBQ59BD2SMRX0HQN7FTJM7F8"

This change enables full compatibility with the OpenAPI JSON-to-TypeScript converter, which already supports strongly typed IDs, achieving strong typing throughout the entire application.

Checklist

linear[bot] commented 2 weeks ago

PP-221 Support sending and receive strongly typed IDs as strings to rest endpoints

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
77.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud