miro_api.models.schema_attribute
Miro Developer Platform
### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? Read our introduction page and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - Quickstart (video): try the REST API in less than 3 minutes. - Quickstart (article): get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - Get started with OAuth 2.0 and Miro ### Miro App Examples Clone our Miro App Examples repository to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0.
The version of the OpenAPI document: v2.0 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4Miro Developer Platform 5 6<img src=\"https://content.pstmn.io/47449ea6-0ef7-4af2-bac1-e58a70e61c58/aW1hZ2UucG5n\" width=\"1685\" height=\"593\"> ### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? [Read our introduction page](https://beta.developers.miro.com/docs/introduction) and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - [Quickstart (video):](https://beta.developers.miro.com/docs/try-out-the-rest-api-in-less-than-3-minutes) try the REST API in less than 3 minutes. - [Quickstart (article):](https://beta.developers.miro.com/docs/build-your-first-hello-world-app-1) get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - [Get started with OAuth 2.0 and Miro](https://beta.developers.miro.com/docs/getting-started-with-oauth) ### Miro App Examples Clone our [Miro App Examples repository](https://github.com/miroapp/app-examples) to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0. 7 8The version of the OpenAPI document: v2.0 9Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11Do not edit the class manually. 12""" # noqa: E501 13 14from __future__ import annotations 15import pprint 16import re # noqa: F401 17import json 18 19from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator 20from typing import Any, ClassVar, Dict, List, Optional 21from typing import Optional, Set 22from typing_extensions import Self 23 24 25class SchemaAttribute(BaseModel): 26 """ 27 Definition of schema attributes. 28 """ # noqa: E501 29 30 schemas: Optional[List[StrictStr]] = Field( 31 default=None, 32 description="Identifies which schema(s) this resource used. In this case it is the SCIM core User/Group schema.", 33 ) 34 name: Optional[StrictStr] = Field(default=None, description="Name of schema attribute.") 35 type: Optional[StrictStr] = Field(default=None, description="Type of schema attribute.") 36 multi_valued: Optional[StrictBool] = Field( 37 default=None, description="Indicates whether the attribute is multi-valued.", alias="multiValued" 38 ) 39 description: Optional[StrictStr] = Field(default=None, description="Description of schema attribute.") 40 required: Optional[StrictBool] = Field(default=None, description="Indicates whether the attribute is required.") 41 sub_attributes: Optional[List[SchemaAttribute]] = Field(default=None, alias="subAttributes") 42 case_exact: Optional[StrictBool] = Field( 43 default=None, description="Indicates whether the attribute is case exact.", alias="caseExact" 44 ) 45 mutability: Optional[StrictStr] = Field(default=None, description="Indicates the mutability of the attribute.") 46 returned: Optional[StrictStr] = Field( 47 default=None, description="Indicates when the attribute is returned in a response." 48 ) 49 uniqueness: Optional[StrictStr] = Field(default=None, description="Indicates the uniqueness of the attribute.") 50 additional_properties: Dict[str, Any] = {} 51 __properties: ClassVar[List[str]] = [ 52 "schemas", 53 "name", 54 "type", 55 "multiValued", 56 "description", 57 "required", 58 "subAttributes", 59 "caseExact", 60 "mutability", 61 "returned", 62 "uniqueness", 63 ] 64 65 @field_validator("schemas") 66 def schemas_validate_enum(cls, value): 67 """Validates the enum""" 68 if value is None: 69 return value 70 71 for i in value: 72 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 73 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 74 return value 75 76 model_config = { 77 "populate_by_name": True, 78 "validate_assignment": True, 79 "protected_namespaces": (), 80 } 81 82 def to_str(self) -> str: 83 """Returns the string representation of the model using alias""" 84 return pprint.pformat(self.model_dump(by_alias=True)) 85 86 def to_json(self) -> str: 87 """Returns the JSON representation of the model using alias""" 88 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 89 return json.dumps(self.to_dict()) 90 91 @classmethod 92 def from_json(cls, json_str: str) -> Optional[Self]: 93 """Create an instance of SchemaAttribute from a JSON string""" 94 return cls.from_dict(json.loads(json_str)) 95 96 def to_dict(self) -> Dict[str, Any]: 97 """Return the dictionary representation of the model using alias. 98 99 This has the following differences from calling pydantic's 100 `self.model_dump(by_alias=True)`: 101 102 * `None` is only added to the output dict for nullable fields that 103 were set at model initialization. Other fields with value `None` 104 are ignored. 105 * Fields in `self.additional_properties` are added to the output dict. 106 """ 107 excluded_fields: Set[str] = set( 108 [ 109 "additional_properties", 110 ] 111 ) 112 113 _dict = self.model_dump( 114 by_alias=True, 115 exclude=excluded_fields, 116 exclude_none=True, 117 ) 118 # override the default output from pydantic by calling `to_dict()` of each item in sub_attributes (list) 119 _items = [] 120 if self.sub_attributes: 121 for _item in self.sub_attributes: 122 if _item: 123 _items.append(_item.to_dict()) 124 _dict["subAttributes"] = _items 125 # puts key-value pairs in additional_properties in the top level 126 if self.additional_properties is not None: 127 for _key, _value in self.additional_properties.items(): 128 _dict[_key] = _value 129 130 return _dict 131 132 @classmethod 133 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 134 """Create an instance of SchemaAttribute from a dict""" 135 if obj is None: 136 return None 137 138 if not isinstance(obj, dict): 139 return cls.model_validate(obj) 140 141 _obj = cls.model_validate( 142 { 143 "schemas": obj.get("schemas"), 144 "name": obj.get("name"), 145 "type": obj.get("type"), 146 "multiValued": obj.get("multiValued"), 147 "description": obj.get("description"), 148 "required": obj.get("required"), 149 "subAttributes": ( 150 [SchemaAttribute.from_dict(_item) for _item in obj["subAttributes"]] 151 if obj.get("subAttributes") is not None 152 else None 153 ), 154 "caseExact": obj.get("caseExact"), 155 "mutability": obj.get("mutability"), 156 "returned": obj.get("returned"), 157 "uniqueness": obj.get("uniqueness"), 158 } 159 ) 160 # store additional fields in additional_properties 161 for _key in obj.keys(): 162 if _key not in cls.__properties: 163 _obj.additional_properties[_key] = obj.get(_key) 164 165 return _obj 166 167 168# TODO: Rewrite to not use raise_errors 169SchemaAttribute.model_rebuild(raise_errors=False)
26class SchemaAttribute(BaseModel): 27 """ 28 Definition of schema attributes. 29 """ # noqa: E501 30 31 schemas: Optional[List[StrictStr]] = Field( 32 default=None, 33 description="Identifies which schema(s) this resource used. In this case it is the SCIM core User/Group schema.", 34 ) 35 name: Optional[StrictStr] = Field(default=None, description="Name of schema attribute.") 36 type: Optional[StrictStr] = Field(default=None, description="Type of schema attribute.") 37 multi_valued: Optional[StrictBool] = Field( 38 default=None, description="Indicates whether the attribute is multi-valued.", alias="multiValued" 39 ) 40 description: Optional[StrictStr] = Field(default=None, description="Description of schema attribute.") 41 required: Optional[StrictBool] = Field(default=None, description="Indicates whether the attribute is required.") 42 sub_attributes: Optional[List[SchemaAttribute]] = Field(default=None, alias="subAttributes") 43 case_exact: Optional[StrictBool] = Field( 44 default=None, description="Indicates whether the attribute is case exact.", alias="caseExact" 45 ) 46 mutability: Optional[StrictStr] = Field(default=None, description="Indicates the mutability of the attribute.") 47 returned: Optional[StrictStr] = Field( 48 default=None, description="Indicates when the attribute is returned in a response." 49 ) 50 uniqueness: Optional[StrictStr] = Field(default=None, description="Indicates the uniqueness of the attribute.") 51 additional_properties: Dict[str, Any] = {} 52 __properties: ClassVar[List[str]] = [ 53 "schemas", 54 "name", 55 "type", 56 "multiValued", 57 "description", 58 "required", 59 "subAttributes", 60 "caseExact", 61 "mutability", 62 "returned", 63 "uniqueness", 64 ] 65 66 @field_validator("schemas") 67 def schemas_validate_enum(cls, value): 68 """Validates the enum""" 69 if value is None: 70 return value 71 72 for i in value: 73 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 74 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 75 return value 76 77 model_config = { 78 "populate_by_name": True, 79 "validate_assignment": True, 80 "protected_namespaces": (), 81 } 82 83 def to_str(self) -> str: 84 """Returns the string representation of the model using alias""" 85 return pprint.pformat(self.model_dump(by_alias=True)) 86 87 def to_json(self) -> str: 88 """Returns the JSON representation of the model using alias""" 89 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 90 return json.dumps(self.to_dict()) 91 92 @classmethod 93 def from_json(cls, json_str: str) -> Optional[Self]: 94 """Create an instance of SchemaAttribute from a JSON string""" 95 return cls.from_dict(json.loads(json_str)) 96 97 def to_dict(self) -> Dict[str, Any]: 98 """Return the dictionary representation of the model using alias. 99 100 This has the following differences from calling pydantic's 101 `self.model_dump(by_alias=True)`: 102 103 * `None` is only added to the output dict for nullable fields that 104 were set at model initialization. Other fields with value `None` 105 are ignored. 106 * Fields in `self.additional_properties` are added to the output dict. 107 """ 108 excluded_fields: Set[str] = set( 109 [ 110 "additional_properties", 111 ] 112 ) 113 114 _dict = self.model_dump( 115 by_alias=True, 116 exclude=excluded_fields, 117 exclude_none=True, 118 ) 119 # override the default output from pydantic by calling `to_dict()` of each item in sub_attributes (list) 120 _items = [] 121 if self.sub_attributes: 122 for _item in self.sub_attributes: 123 if _item: 124 _items.append(_item.to_dict()) 125 _dict["subAttributes"] = _items 126 # puts key-value pairs in additional_properties in the top level 127 if self.additional_properties is not None: 128 for _key, _value in self.additional_properties.items(): 129 _dict[_key] = _value 130 131 return _dict 132 133 @classmethod 134 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 135 """Create an instance of SchemaAttribute from a dict""" 136 if obj is None: 137 return None 138 139 if not isinstance(obj, dict): 140 return cls.model_validate(obj) 141 142 _obj = cls.model_validate( 143 { 144 "schemas": obj.get("schemas"), 145 "name": obj.get("name"), 146 "type": obj.get("type"), 147 "multiValued": obj.get("multiValued"), 148 "description": obj.get("description"), 149 "required": obj.get("required"), 150 "subAttributes": ( 151 [SchemaAttribute.from_dict(_item) for _item in obj["subAttributes"]] 152 if obj.get("subAttributes") is not None 153 else None 154 ), 155 "caseExact": obj.get("caseExact"), 156 "mutability": obj.get("mutability"), 157 "returned": obj.get("returned"), 158 "uniqueness": obj.get("uniqueness"), 159 } 160 ) 161 # store additional fields in additional_properties 162 for _key in obj.keys(): 163 if _key not in cls.__properties: 164 _obj.additional_properties[_key] = obj.get(_key) 165 166 return _obj
Definition of schema attributes.
66 @field_validator("schemas") 67 def schemas_validate_enum(cls, value): 68 """Validates the enum""" 69 if value is None: 70 return value 71 72 for i in value: 73 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 74 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 75 return value
Validates the enum
83 def to_str(self) -> str: 84 """Returns the string representation of the model using alias""" 85 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
87 def to_json(self) -> str: 88 """Returns the JSON representation of the model using alias""" 89 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 90 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
92 @classmethod 93 def from_json(cls, json_str: str) -> Optional[Self]: 94 """Create an instance of SchemaAttribute from a JSON string""" 95 return cls.from_dict(json.loads(json_str))
Create an instance of SchemaAttribute from a JSON string
97 def to_dict(self) -> Dict[str, Any]: 98 """Return the dictionary representation of the model using alias. 99 100 This has the following differences from calling pydantic's 101 `self.model_dump(by_alias=True)`: 102 103 * `None` is only added to the output dict for nullable fields that 104 were set at model initialization. Other fields with value `None` 105 are ignored. 106 * Fields in `self.additional_properties` are added to the output dict. 107 """ 108 excluded_fields: Set[str] = set( 109 [ 110 "additional_properties", 111 ] 112 ) 113 114 _dict = self.model_dump( 115 by_alias=True, 116 exclude=excluded_fields, 117 exclude_none=True, 118 ) 119 # override the default output from pydantic by calling `to_dict()` of each item in sub_attributes (list) 120 _items = [] 121 if self.sub_attributes: 122 for _item in self.sub_attributes: 123 if _item: 124 _items.append(_item.to_dict()) 125 _dict["subAttributes"] = _items 126 # puts key-value pairs in additional_properties in the top level 127 if self.additional_properties is not None: 128 for _key, _value in self.additional_properties.items(): 129 _dict[_key] = _value 130 131 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
133 @classmethod 134 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 135 """Create an instance of SchemaAttribute from a dict""" 136 if obj is None: 137 return None 138 139 if not isinstance(obj, dict): 140 return cls.model_validate(obj) 141 142 _obj = cls.model_validate( 143 { 144 "schemas": obj.get("schemas"), 145 "name": obj.get("name"), 146 "type": obj.get("type"), 147 "multiValued": obj.get("multiValued"), 148 "description": obj.get("description"), 149 "required": obj.get("required"), 150 "subAttributes": ( 151 [SchemaAttribute.from_dict(_item) for _item in obj["subAttributes"]] 152 if obj.get("subAttributes") is not None 153 else None 154 ), 155 "caseExact": obj.get("caseExact"), 156 "mutability": obj.get("mutability"), 157 "returned": obj.get("returned"), 158 "uniqueness": obj.get("uniqueness"), 159 } 160 ) 161 # store additional fields in additional_properties 162 for _key in obj.keys(): 163 if _key not in cls.__properties: 164 _obj.additional_properties[_key] = obj.get(_key) 165 166 return _obj
Create an instance of SchemaAttribute from a dict
265def init_private_attributes(self: BaseModel, __context: Any) -> None: 266 """This function is meant to behave like a BaseModel method to initialise private attributes. 267 268 It takes context as an argument since that's what pydantic-core passes when calling it. 269 270 Args: 271 self: The BaseModel instance. 272 __context: The context. 273 """ 274 if getattr(self, '__pydantic_private__', None) is None: 275 pydantic_private = {} 276 for name, private_attr in self.__private_attributes__.items(): 277 default = private_attr.get_default() 278 if default is not PydanticUndefined: 279 pydantic_private[name] = default 280 object_setattr(self, '__pydantic_private__', pydantic_private)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that's what pydantic-core passes when calling it.
Args: self: The BaseModel instance. __context: The context.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs