mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
marker: fix PUT marker with an enabled-only body (bpf no longer required)
update_marker reused MarkerCreate, whose bpf is required, so a partial PUT like
{"enabled": false} was rejected with 422 "bpf field required". Add a MarkerUpdate
schema with every field optional (bpf included; capture_node_id and name are
create-only/path-driven and omitted) and use it for the PUT route — partial
updates now validate cleanly.
This commit is contained in:
3 files changed
+25
-2
No files matched your search
@@ -191,6 +191,29 @@ class MarkerCreate(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class MarkerUpdate(BaseModel):
|
||||
"""
|
||||
Body for updating a marker — partial update, every field optional.
|
||||
|
||||
``bpf`` is optional here (it is required on create). ``capture_node_id`` and
|
||||
``name`` are create-only / path-driven and intentionally absent; an explicit
|
||||
``direction: null`` clears the direction back to both (omitting keeps it).
|
||||
"""
|
||||
|
||||
bpf: Optional[str] = None
|
||||
tag: Optional[int] = None
|
||||
direction: Optional[str] = Field(
|
||||
None,
|
||||
pattern=r"^(tx|rx)$",
|
||||
description="Direction filter; an explicit null clears it to both. Omit to keep.",
|
||||
)
|
||||
color: Optional[str] = Field(None, description="Hex color render hint, e.g. '#ff5722'")
|
||||
highlight_duration: Optional[int] = Field(
|
||||
None, ge=1, description="UI highlight duration in ms; null = UI default"
|
||||
)
|
||||
enabled: Optional[bool] = Field(None, description="Toggle the marker on/off (instant).")
|
||||
|
||||
|
||||
class MarkerDefinitionCreate(BaseModel):
|
||||
"""
|
||||
Body for creating / updating a project-level marker definition.
|
||||
|
||||
Reference in new issue
Block a user