Skip to content

Commit 6686833

Browse files
幾田純平claude
authored andcommitted
fix: reject non-alphanumeric SN codes in POST /v1/devices (Closes #3)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a61a3a4 commit 6686833

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

openapi.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,8 @@
13841384
"schema": {
13851385
"type": "string",
13861386
"minLength": 1,
1387-
"maxLength": 256
1387+
"maxLength": 256,
1388+
"pattern": "^[a-zA-Z0-9_-]+$"
13881389
},
13891390
"description": "Device serial number",
13901391
"example": "SFVA78RABZ12345678"
@@ -7308,6 +7309,7 @@
73087309
"sn": {
73097310
"type": "string",
73107311
"nullable": true,
7312+
"pattern": "^[a-zA-Z0-9_-]+$",
73117313
"description": "Serial number of the device."
73127314
},
73137315
"display_name": {
@@ -7447,6 +7449,7 @@
74477449
},
74487450
"sn": {
74497451
"type": "string",
7452+
"pattern": "^[a-zA-Z0-9_-]+$",
74507453
"description": "Serial number of the device. This field is required when creating a device."
74517454
}
74527455
}
@@ -7469,7 +7472,8 @@
74697472
},
74707473
"sn": {
74717474
"type": "string",
7472-
"nullable": true
7475+
"nullable": true,
7476+
"pattern": "^[a-zA-Z0-9_-]+$"
74737477
},
74747478
"display_name": {
74757479
"type": "string",
@@ -7500,6 +7504,7 @@
75007504
"properties": {
75017505
"sn": {
75027506
"type": "string",
7507+
"pattern": "^[a-zA-Z0-9_-]+$",
75037508
"description": "Device serial number",
75047509
"example": "SFVA78RABZ12345678"
75057510
},

openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ paths:
10441044
type: string
10451045
minLength: 1
10461046
maxLength: 256
1047+
pattern: ^[a-zA-Z0-9_-]+$
10471048
description: Device serial number
10481049
example: SFVA78RABZ12345678
10491050
get:
@@ -5776,6 +5777,7 @@ components:
57765777
sn:
57775778
type: string
57785779
nullable: true
5780+
pattern: ^[a-zA-Z0-9_-]+$
57795781
description: Serial number of the device.
57805782
display_name:
57815783
type: string
@@ -5940,6 +5942,7 @@ components:
59405942
'
59415943
sn:
59425944
type: string
5945+
pattern: ^[a-zA-Z0-9_-]+$
59435946
description: Serial number of the device. This field is required when creating
59445947
a device.
59455948
DeviceUpdate:
@@ -5962,6 +5965,7 @@ components:
59625965
sn:
59635966
type: string
59645967
nullable: true
5968+
pattern: ^[a-zA-Z0-9_-]+$
59655969
display_name:
59665970
type: string
59675971
nullable: true
@@ -5982,6 +5986,7 @@ components:
59825986
properties:
59835987
sn:
59845988
type: string
5989+
pattern: ^[a-zA-Z0-9_-]+$
59855990
description: Device serial number
59865991
example: SFVA78RABZ12345678
59875992
model_name:

0 commit comments

Comments
 (0)