The domain crate is intentionally I/O-free (only uuid + serde). When real entities start surfacing through the API, newtypes like OrgId will need utoipa::ToSchema to appear in the OpenAPI document — but we don't want to compromise domain's purity.
Decide the approach before the first entity lands:
Option A: Allow the utoipa derive in domain (it's a non-I/O, schema-only dependency).
Option B: Keep domain free of utoipa and define ToSchema wrappers/DTOs in the api crate.
Trade-off: A is less boilerplate but widens domain's dependency surface; B keeps domain minimal but adds a mapping layer. Pick one and document it in the architecture spec.
Source: Foundation (Plan 0) final review — forward-looking.
The `domain` crate is intentionally I/O-free (only `uuid` + `serde`). When real entities start surfacing through the API, newtypes like `OrgId` will need `utoipa::ToSchema` to appear in the OpenAPI document — but we don't want to compromise `domain`'s purity.
Decide the approach before the first entity lands:
- **Option A:** Allow the `utoipa` derive in `domain` (it's a non-I/O, schema-only dependency).
- **Option B:** Keep `domain` free of `utoipa` and define `ToSchema` wrappers/DTOs in the `api` crate.
Trade-off: A is less boilerplate but widens `domain`'s dependency surface; B keeps `domain` minimal but adds a mapping layer. Pick one and document it in the architecture spec.
_Source: Foundation (Plan 0) final review — forward-looking._
Decision: Option A — allow the utoipa::ToSchema derive in domain.
Rationale: domain already carries serde/serde_json/time (data-shape deps, no real I/O), and utoipa is a schema-description macro in that same family — not runtime I/O (no axum/sqlx). Visibility and AuthorityKind already derive Serialize/Deserialize with #[serde(rename_all = "lowercase")], so adding ToSchema is a one-word change that yields proper string enums with no duplicate enum set to maintain in api. The mapping layer that Option B would add (parallel enums + domain→api conversion) isn't worth it for fixed ≤7-variant sets.
Scope of the rule: domain may derive ToSchema (and use #[schema(...)] attrs) on pure data types. It must NOT gain runtime-I/O deps (axum, sqlx, etc.) — the api crate still owns HTTP/DB concerns and its own request/response View DTOs.
Implemented alongside #29 (enum-typing) and #24 (open-map fields). Closing.
**Decision: Option A** — allow the `utoipa::ToSchema` derive in `domain`.
Rationale: `domain` already carries `serde`/`serde_json`/`time` (data-shape deps, no real I/O), and `utoipa` is a schema-description macro in that same family — not runtime I/O (no axum/sqlx). `Visibility` and `AuthorityKind` already derive `Serialize`/`Deserialize` with `#[serde(rename_all = "lowercase")]`, so adding `ToSchema` is a one-word change that yields proper string enums with **no duplicate enum set** to maintain in `api`. The mapping layer that Option B would add (parallel enums + domain→api conversion) isn't worth it for fixed ≤7-variant sets.
Scope of the rule: `domain` may derive `ToSchema` (and use `#[schema(...)]` attrs) on pure data types. It must NOT gain runtime-I/O deps (axum, sqlx, etc.) — the `api` crate still owns HTTP/DB concerns and its own request/response View DTOs.
Implemented alongside #29 (enum-typing) and #24 (open-map `fields`). Closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The
domaincrate is intentionally I/O-free (onlyuuid+serde). When real entities start surfacing through the API, newtypes likeOrgIdwill needutoipa::ToSchemato appear in the OpenAPI document — but we don't want to compromisedomain's purity.Decide the approach before the first entity lands:
utoipaderive indomain(it's a non-I/O, schema-only dependency).domainfree ofutoipaand defineToSchemawrappers/DTOs in theapicrate.Trade-off: A is less boilerplate but widens
domain's dependency surface; B keepsdomainminimal but adds a mapping layer. Pick one and document it in the architecture spec.Source: Foundation (Plan 0) final review — forward-looking.
Decision: Option A — allow the
utoipa::ToSchemaderive indomain.Rationale:
domainalready carriesserde/serde_json/time(data-shape deps, no real I/O), andutoipais a schema-description macro in that same family — not runtime I/O (no axum/sqlx).VisibilityandAuthorityKindalready deriveSerialize/Deserializewith#[serde(rename_all = "lowercase")], so addingToSchemais a one-word change that yields proper string enums with no duplicate enum set to maintain inapi. The mapping layer that Option B would add (parallel enums + domain→api conversion) isn't worth it for fixed ≤7-variant sets.Scope of the rule:
domainmay deriveToSchema(and use#[schema(...)]attrs) on pure data types. It must NOT gain runtime-I/O deps (axum, sqlx, etc.) — theapicrate still owns HTTP/DB concerns and its own request/response View DTOs.Implemented alongside #29 (enum-typing) and #24 (open-map
fields). Closing.