Skip to content

Commit cb8bfd6

Browse files
committed
fix(spec): restore writeOnly on passwordProfile.password + describe PartialSuccess
Two leftover smells from the original v1.0.yaml that the TypeSpec port had inherited unchanged: `passwordProfile.password` lost `writeOnly: true` during the migration because the idiomatic `@visibility(Lifecycle.Create, Lifecycle.Update)` triggers Read/Update variant generation that collides with the explicit `@friendlyName("userUpdate")` on `userBase`. Switch to `@extension("writeOnly", true)` which emits the JSON Schema flag directly without involving TypeSpec's visibility/variant machinery — the OpenAPI now carries `writeOnly: true` again, the generated clients get the matching marker. `PartialSuccess` (the 207 response on `invite` / `createLink`) carried a literal `"Partial success response TODO"` description from the hand-written spec. Replace with a real explanation: `207` means at least one sub-operation failed (e.g. one invitee out of many couldn't be granted access), body shape is unspecified, clients should treat it as a soft failure and inspect server-side state to determine which sub-operations succeeded.
1 parent 7d86466 commit cb8bfd6

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

spec/common.models.tsp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ model passwordProfile {
116116
@doc("If true the user is required to change their password upon the next login")
117117
forceChangePasswordNextSignIn?: boolean = false;
118118

119-
// `writeOnly: true` in the existing v1.0.yaml. TypeSpec's idiomatic
120-
// way to express that is `@visibility(Lifecycle.Create, Lifecycle.Update)`,
121-
// but applying it here triggers Read/Update variant generation for
122-
// every model that transitively references `passwordProfile`
123-
// (`userBase`, `educationUser`, …). The auto-variant for
119+
// `@extension("writeOnly", true)` emits the JSON Schema `writeOnly`
120+
// flag directly. The idiomatic TypeSpec equivalent
121+
// `@visibility(Lifecycle.Create, Lifecycle.Update)` would also work
122+
// semantically but triggers Read/Update variant generation for every
123+
// model that transitively references `passwordProfile`
124+
// (`userBase`, `educationUser`, …); the resulting auto-variant for
124125
// `userResource` then collides with `userBase`'s
125126
// `@friendlyName("userUpdate")` and the build fails with
126-
// `duplicate-type-name: 'userUpdate'`. Dropping the marker is the
127-
// smaller cost; `writeOnly: true` is informational and does not
128-
// change the resolved schema or the generated client surface.
127+
// `duplicate-type-name: 'userUpdate'`.
129128
@doc("The user's password")
129+
@extension("writeOnly", true)
130130
password?: string;
131131
}
132132

spec/drives.models.tsp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,14 @@ model CreateLinkResponse {
866866
@body body: permission;
867867
}
868868

869-
@doc("Partial success response TODO")
869+
@doc("""
870+
Multi-Status. The operation has completed but at least one sub-operation
871+
did not succeed — typically returned by `invite` when the call carries
872+
multiple recipients and only some of them could be granted access. The
873+
body shape is intentionally unspecified for now; clients should treat
874+
`207` as a soft failure and inspect server-side logs or the resource
875+
state to determine which sub-operations succeeded.
876+
""")
870877
model PartialSuccess {
871878
@statusCode _: 207;
872879
}

0 commit comments

Comments
 (0)