Skip to content

Commit

Permalink
Merge pull request #518 from nautobot/kc-minor-doc-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrew82 authored Aug 23, 2024
2 parents 3107036 + e0a2d5b commit cff796b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions changes/518.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Minor doc updates on upgrade to 3.0.
16 changes: 9 additions & 7 deletions docs/dev/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NautobotAdapter(Adapter)

## Set defaults for Optional

One of the changes with pydantic v2 is that any variables that are Optional must have a default of None defined. This needs to be done on your class attributes like below:
One of the changes with Pydantic v2 is that any variables that are Optional must have a default of None defined. This needs to be done on your class attributes like below:

```python
class DeviceModel(NautobotModel):
Expand All @@ -46,11 +46,11 @@ class DeviceModel(NautobotModel):
name: str
location__name: str
location__location_type__name: str
location__parent__name: Optional[str]
location__parent__location_type__name: Optional[str]
location__parent__name: Optional[str] # Pydantic v1, replace
location__parent__location_type__name: Optional[str] # Pydantic v1, replace
device_type__manufacturer__name: str
device_type__model: str
platform__name: Optional[str]
platform__name: Optional[str] # Pydantic v1, replace
role__name: str
serial: str
status__name: str
Expand Down Expand Up @@ -78,11 +78,11 @@ class DeviceModel(NautobotModel):
name: str
location__name: str
location__location_type__name: str
location__parent__name: Optional[str] = None
location__parent__location_type__name: Optional[str] = None
location__parent__name: Optional[str] = None # Pydantic v2 compatibile
location__parent__location_type__name: Optional[str] = None # Pydantic v2 compatibile
device_type__manufacturer__name: str
device_type__model: str
platform__name: Optional[str] = None
platform__name: Optional[str] = None # Pydantic v2 compatibile
role__name: str
serial: str
status__name: str
Expand All @@ -96,6 +96,8 @@ Any instances where you're referring to the diffsync kwarg needs to be updated t
self.diffsync.job.logger.warning("Example")
```

is changed to the following:

```python
self.adapter.job.logger.warning("Example")
```

0 comments on commit cff796b

Please sign in to comment.