Use lists for tags instead of dicts

This commit is contained in:
grossmj committed 2026-02-23 23:26:42 +08:00
1 parent 66f32cecf2
commit bdcb6445c7
6 files changed
+28 -49

No files matched your search

+6 -6
View File
@@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from pydantic import BaseModel, Field, model_validator
from typing import List, Optional, Union, Any, Dict
from pydantic import BaseModel, Field
from typing import List, Optional, Union
from enum import Enum
from uuid import UUID, uuid4
@@ -128,14 +128,14 @@ class NodeBase(BaseModel):
z: Optional[int] = 1
locked: Optional[bool] = Field(False, description="Whether the element locked or not")
port_name_format: Optional[str] = Field(
None, descript_port_name_formation="Formatting for port name {0} will be replace by port number"
None, description="Formatting for port name {0} will be replace by port number"
)
port_segment_size: Optional[int] = Field(None, description="Size of the port segment")
first_port_name: Optional[str] = Field(None, description="Name of the first port")
custom_adapters: Optional[List[CustomAdapter]] = None
tags: Optional[Dict[str, str]] = Field(
default_factory=dict,
description="User-defined metadata tags inherited from template or custom"
tags: Optional[List[str]] = Field(
default_factory=list,
description="User-defined metadata tags (e.g. 'vendor:cisco' or 'model:7200')"
)
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from pydantic import ConfigDict, BaseModel, Field
from typing import Optional, Union, Dict
from typing import Optional, List
from enum import Enum
from uuid import UUID
@@ -48,9 +48,9 @@ class TemplateBase(BaseModel):
template_type: Optional[NodeType] = None
compute_id: Optional[str] = None
usage: Optional[str] = ""
tags: Optional[Dict[str, str]] = Field(
default_factory=dict,
description="User-defined metadata tags as key-value pairs (e.g., {'vendor': 'cisco', 'model': '7200', 'netmiko_device_type': 'cisco_ios'})"
tags: Optional[List[str]] = Field(
default_factory=list,
description="User-defined metadata tags (e.g. 'vendor:cisco' or 'model:7200')"
)