-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcustomproperty.py
More file actions
40 lines (28 loc) · 1.41 KB
/
customproperty.py
File metadata and controls
40 lines (28 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from glean.api_client.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Any, Optional
from typing_extensions import NotRequired, TypedDict
class CustomPropertyTypedDict(TypedDict):
r"""Describes the custom properties of the object."""
name: NotRequired[str]
value: NotRequired[Any]
r"""Must be a string, a number (for INT properties), or an array of strings. A boolean is not valid. When OpenAPI Generator supports `oneOf`, we can semantically enforce this."""
class CustomProperty(BaseModel):
r"""Describes the custom properties of the object."""
name: Optional[str] = None
value: Optional[Any] = None
r"""Must be a string, a number (for INT properties), or an array of strings. A boolean is not valid. When OpenAPI Generator supports `oneOf`, we can semantically enforce this."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["name", "value"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m