Skip to content
This repository was archived by the owner on Sep 28, 2026. It is now read-only.

Commit ea5f146

Browse files
Type Narrowing
Copilot identified these items to have stricter typing info.
1 parent 994f20a commit ea5f146

1 file changed

Lines changed: 25 additions & 81 deletions

File tree

‎specs/Url-Shortener.json‎

Lines changed: 25 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,9 @@
273273
},
274274
"count": {
275275
"description": "Current increment for the id number if the domain is in ID number mode. Always incremented even if not in ID mode so as to be able to swap to ID mode if requested with no risk for collision.",
276-
"type": "number",
276+
"type": "integer",
277277
"format": "int32",
278+
"minimum": 0,
278279
"readOnly": true
279280
},
280281
"hidden": {
@@ -283,7 +284,8 @@
283284
},
284285
"hostName": {
285286
"description": "String to be used in matching the host name. Subdomains need to have their own record to be usable.",
286-
"type": "string"
287+
"type": "string",
288+
"format": "hostname"
287289
},
288290
"type": {
289291
"description": "Flag that indicates the type of shortened URL that can be generated on the domain: `vanity` allows any user structure as long as it is unique. Example: `https://example.com/myUrl`, `idNumber` locks out user control of the vanity URL and hard codes it to an ID number. Example: `https://example.com/managedLink?id=123`.",
@@ -340,7 +342,8 @@
340342
"createdAt": {
341343
"description": "Time stamp of when the assignment was created.",
342344
"type": "string",
343-
"format": "date-time"
345+
"format": "date-time",
346+
"readOnly": true
344347
},
345348
"targetId": {
346349
"description": "Unique ID of the system that this assignment describes.",
@@ -467,7 +470,7 @@
467470
"description": "Check the health of the various components of the URL Shortener and report back. Useful for automated health probing.",
468471
"operationId": "/Api/Core/Health/Get",
469472
"responses": {
470-
"201": {
473+
"204": {
471474
"description": "Service is operational!"
472475
},
473476
"500": {
@@ -662,6 +665,7 @@
662665
"description": "Creates new URL redirect record in the database and returns information enriched with created metadata.\n\nThis endpoint does not have scope (permission) restrictions.",
663666
"operationId": "/Api/Redirect/Post",
664667
"requestBody": {
668+
"required": true,
665669
"content": {
666670
"application/json": {
667671
"examples": {
@@ -694,24 +698,7 @@
694698
}
695699
},
696700
"schema": {
697-
"allOf": [
698-
{
699-
"$ref": "#/components/schemas/Redirect.UrlConfiguration"
700-
},
701-
{
702-
"required": [
703-
"sourceUrl",
704-
"customUserAgentMatcher",
705-
"targetUrl",
706-
"targetUrlCustom",
707-
"targetUrlMobile",
708-
"targetUrlNodeJs",
709-
"targetUrlPowershell",
710-
"targetUrlPython",
711-
"type"
712-
]
713-
}
714-
]
701+
"$ref": "#/components/schemas/Redirect.UrlConfiguration"
715702
}
716703
}
717704
}
@@ -742,6 +729,7 @@
742729
"description": "Validates if provided target name is available to be requested. Returns boolean `true` if the name is available, `false` if the name is already recorded.\n\nThis endpoint does not have scope (permission) restrictions.",
743730
"operationId": "/Api/Redirect/Check/Post",
744731
"requestBody": {
732+
"required": true,
745733
"content": {
746734
"application/json": {
747735
"examples": {
@@ -763,7 +751,10 @@
763751
"description": "URL to check if is taken or not.",
764752
"type": "string"
765753
}
766-
}
754+
},
755+
"required": [
756+
"sourceName"
757+
]
767758
}
768759
}
769760
}
@@ -843,14 +834,7 @@
843834
}
844835
},
845836
"schema": {
846-
"allOf": [
847-
{
848-
"$ref": "#/components/schemas/Redirect.UrlConfiguration"
849-
},
850-
{
851-
"required": []
852-
}
853-
]
837+
"$ref": "#/components/schemas/Redirect.UrlConfiguration"
854838
}
855839
}
856840
}
@@ -956,6 +940,7 @@
956940
"description": "Create new record of the banned term.\n\nThis endpoint requires the `BanList.ReadWrite.All` or `Everything.ReadWrite.All` scope (permission).",
957941
"operationId": "/Api/BannedName/Post",
958942
"requestBody": {
943+
"required": true,
959944
"content": {
960945
"application/json": {
961946
"examples": {
@@ -974,17 +959,7 @@
974959
}
975960
},
976961
"schema": {
977-
"allOf": [
978-
{
979-
"$ref": "#/components/schemas/Redirect.BannedTerm"
980-
},
981-
{
982-
"required": [
983-
"name",
984-
"type"
985-
]
986-
}
987-
]
962+
"$ref": "#/components/schemas/Redirect.BannedTerm"
988963
}
989964
}
990965
}
@@ -1043,7 +1018,7 @@
10431018
},
10441019
"delete": {
10451020
"summary": "Removes Specific Banned Name Record",
1046-
"description": "Deletes the banned name record from the database.\n\nThis endpoint requires the `BanList.ReadWrite.All` or `Everything.ReadWrite.All` scope (permission).",
1021+
"description": "Deletes the banned name record from the database.\n\nThis endpoint requires an RBAC assignment or the `BanList.ReadWrite.All` or `Everything.ReadWrite.All` scope (permission).",
10471022
"operationId": "/Api/BannedName/:id/Delete",
10481023
"parameters": [
10491024
{
@@ -1083,7 +1058,8 @@
10831058
"description": "Filter by the `count` field.",
10841059
"schema": {
10851060
"type": "integer",
1086-
"format": "int32"
1061+
"format": "int32",
1062+
"minimum": 0
10871063
}
10881064
},
10891065
{
@@ -1145,6 +1121,7 @@
11451121
"description": "Creates new domain name record in the database and returns information enriched with created metadata.\n\nThis endpoint requires the `Domain.ReadWrite.All` or `Everything.ReadWrite.All` scope (permission).",
11461122
"operationId": "/Api/Domain/Post",
11471123
"requestBody": {
1124+
"required": true,
11481125
"content": {
11491126
"application/json": {
11501127
"examples": {
@@ -1167,20 +1144,7 @@
11671144
}
11681145
},
11691146
"schema": {
1170-
"allOf": [
1171-
{
1172-
"$ref": "#/components/schemas/Redirect.DomainName"
1173-
},
1174-
{
1175-
"required": [
1176-
"allowHttp",
1177-
"count",
1178-
"hidden",
1179-
"hostName",
1180-
"type"
1181-
]
1182-
}
1183-
]
1147+
"$ref": "#/components/schemas/Redirect.DomainName"
11841148
}
11851149
}
11861150
}
@@ -1254,20 +1218,12 @@
12541218
"description": "Payload contains one or more fields that need update in the database.",
12551219
"value": {
12561220
"allowHttp": false,
1257-
"count": 18,
12581221
"type": "idNumber"
12591222
}
12601223
}
12611224
},
12621225
"schema": {
1263-
"allOf": [
1264-
{
1265-
"$ref": "#/components/schemas/Redirect.DomainName"
1266-
},
1267-
{
1268-
"required": []
1269-
}
1270-
]
1226+
"$ref": "#/components/schemas/Redirect.DomainName"
12711227
}
12721228
}
12731229
}
@@ -1423,6 +1379,7 @@
14231379
"description": "Create new RBAC assignment record in the database and returns information enriched with created metadata.\n\nThis endpoint does not have implicit scope (permission) restrictions but includes an internal check on user's access level.",
14241380
"operationId": "/Api/Rbac/Post",
14251381
"requestBody": {
1382+
"required": true,
14261383
"content": {
14271384
"application/json": {
14281385
"examples": {
@@ -1446,20 +1403,7 @@
14461403
}
14471404
},
14481405
"schema": {
1449-
"allOf": [
1450-
{
1451-
"$ref": "#/components/schemas/Redirect.RbacAssignment"
1452-
},
1453-
{
1454-
"required": [
1455-
"assignmentTargetType",
1456-
"targetId",
1457-
"principalId",
1458-
"principalType",
1459-
"role"
1460-
]
1461-
}
1462-
]
1406+
"$ref": "#/components/schemas/Redirect.RbacAssignment"
14631407
}
14641408
}
14651409
}

0 commit comments

Comments
 (0)