Skip to content

Commit 85208d8

Browse files
committed
fix: address second round of Copilot review comments on opencloud-eu#45
- `Makefile`: pass `HOME=/tmp` + `npm_config_cache=/tmp/.npm` into the spec compile container so `npm ci` can write its cache/state when the host uid/gid doesn't match `/home/node` in `node:22-alpine`. - `spec/common.models.tsp`: move `SearchParam` here from `groups.tsp`. It's a generic OData `$search` query parameter and was creating an unnecessary `users.tsp -> groups.tsp` dependency. - `spec/permissions.routes.tsp`: fix the role-id path parameter in each `GetPermissionRoleDefinition` `@opExample` so it matches the role id in the corresponding response body. Also align the File Drop `allowedResourceActions` value (`upload/create`) with the list endpoint's example. - `spec/tags.tsp`: make the request body required on `assignTags` and `unassignTags` (the body schemas require `resourceId` and `tags`, so a body-less call can't succeed). Update `TagsOk`'s doc from "No content" to "Success" since the status code is 200 with empty body. - `spec/permissions.models.tsp`: typo `than can be used` -> `that can be used`.
1 parent 2265078 commit 85208d8

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ help: ## Show this help
3333
spec: $(SPEC) ## Compile TypeSpec sources into api/openapi-spec/v1.0.yaml
3434

3535
$(SPEC): $(SPEC_SOURCES)
36-
$(DOCKER_RUN) $(NODE_IMAGE) sh scripts/compile-spec.sh
36+
$(DOCKER_RUN) -e HOME=/tmp -e npm_config_cache=/tmp/.npm $(NODE_IMAGE) sh scripts/compile-spec.sh
3737

3838
go: $(SPEC) ## Generate the Go client into build/clients/go
3939
$(DOCKER_RUN) -e OUTPUT_DIR=build/clients/go $(call generator_image,go) sh scripts/generate-go.sh

spec/common.models.tsp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,10 @@ model TopParam {
6767
@minValue(0)
6868
`$top`?: integer;
6969
}
70+
71+
@friendlyName("search")
72+
model SearchParam {
73+
@query
74+
@doc("Search items by search phrases")
75+
`$search`?: string;
76+
}

spec/groups.tsp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ model groupModel {
4242
// Shared query parameters / response shapes
4343
// =============================================================================
4444

45-
@friendlyName("search")
46-
model SearchParam {
47-
@query
48-
@doc("Search items by search phrases")
49-
`$search`?: string;
50-
}
51-
5245
model GroupIdPath {
5346
@path
5447
@extension("x-ms-docs-key-type", "group")

spec/permissions.models.tsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ model unifiedRoleDefinition {
7272
`@libre.graph.weight`?: int32;
7373
}
7474

75-
@doc("A list of permission roles than can be used when sharing with users or groups.")
75+
@doc("A list of permission roles that can be used when sharing with users or groups.")
7676
model RoleDefinitionsListed {
7777
@statusCode _: 200;
7878
@body body: unifiedRoleDefinition[];

spec/permissions.routes.tsp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace PermissionRoleDefinition {
120120
)
121121
@opExample(
122122
#{
123-
parameters: #{`role-id`: "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"},
123+
parameters: #{`role-id`: "fb6c3e19-e378-47e5-b277-9732f9de6e21"},
124124
returnType: #{
125125
_: 200,
126126
body: #{
@@ -141,7 +141,7 @@ namespace PermissionRoleDefinition {
141141
)
142142
@opExample(
143143
#{
144-
parameters: #{`role-id`: "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"},
144+
parameters: #{`role-id`: "312c0871-5ef7-4b3a-85b6-0e4074c64049"},
145145
returnType: #{
146146
_: 200,
147147
body: #{
@@ -162,7 +162,7 @@ namespace PermissionRoleDefinition {
162162
)
163163
@opExample(
164164
#{
165-
parameters: #{`role-id`: "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"},
165+
parameters: #{`role-id`: "4916f47e-66d5-49bb-9ac9-748ad00334b"},
166166
returnType: #{
167167
_: 200,
168168
body: #{
@@ -171,7 +171,7 @@ namespace PermissionRoleDefinition {
171171
displayName: "File Drop",
172172
rolePermissions: #[
173173
#{
174-
allowedResourceActions: #["libre.graph/driveItem/standard/create"],
174+
allowedResourceActions: #["libre.graph/driveItem/upload/create"],
175175
condition: "exists @Resource.File",
176176
},
177177
],

spec/tags.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ model TagsRetrieved {
2626

2727
alias tagsResponse = Collection<string, "CollectionOfTags">;
2828

29-
@doc("No content")
29+
@doc("Success")
3030
model TagsOk {
3131
@statusCode _: 200;
3232
}
@@ -57,7 +57,7 @@ namespace Tags {
5757
@put
5858
op assignTags(
5959
@body
60-
body?: tagAssignment,
60+
body: tagAssignment,
6161
): TagsOk | OdataError;
6262

6363
@summary("Unassign tags from a resource")
@@ -77,6 +77,6 @@ namespace Tags {
7777
@delete
7878
op unassignTags(
7979
@body
80-
body?: tagUnassignment,
80+
body: tagUnassignment,
8181
): TagsOk | OdataError;
8282
}

0 commit comments

Comments
 (0)