prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Swagger references IP address family incorrectly as string in NestedIPAddress.
  <!--
      NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.
  
      This form is only for reproducible bugs. If you need assistance with
      NetBox installation, or if you have a general question, DO NOT open an
      issue. Instead, post to our mailing list:
  
          https://groups.google.com/forum/#!forum/netbox-discuss
  
      Please describe the environment in which you are running NetBox. Be sure
      that you are running an unmodified instance of the latest stable release
      before submitting a bug report, and that any plugins have been disabled.
  -->
  ### Environment
  * Python version: netbox-docker
  * NetBox version: 2.8.6
  
  <!--
      Describe in detail the exact steps that someone else can take to reproduce
      this bug using the current stable release of NetBox. Begin with the
      creation of any necessary database objects and call out every operation
      being performed explicitly. If reporting a bug in the REST API, be sure to
      reconstruct the raw HTTP request(s) being made: Don't rely on a client
      library such as pynetbox.
  -->
  ### Steps to Reproduce
  1. Generate go-netbox with latest swagger https://github.com/netbox-community/go-netbox
  2. Attempt to pull device information with dcim.DcimDevicesListParams on a device / rack that contains a primary ip configured on an device.
  3. "cannot unmarshal number into Go struct field NestedIPAddress.results.primary_ip.family of type string"
  
  <!-- What did you expect to happen? -->
  ### Expected Behavior
  Swagger to match returned data.
  
  <!-- What happened instead? -->
  ### Observed Behavior
  Api returns Family as an number instead of a string, mismatching with swagger.
  ```
  json: cannot unmarshal number into Go struct field NestedIPAddress.results.primary_ip.family of type string
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `netbox/ipam/api/nested_serializers.py`
  Content:
  ```
  1 from rest_framework import serializers
  2 
  3 from ipam import models
  4 from utilities.api import WritableNestedSerializer
  5 
  6 __all__ = [
  7     'NestedAggregateSerializer',
  8     'NestedIPAddressSerializer',
  9     'NestedPrefixSerializer',
  10     'NestedRIRSerializer',
  11     'NestedRoleSerializer',
  12     'NestedServiceSerializer',
  13     'NestedVLANGroupSerializer',
  14     'NestedVLANSerializer',
  15     'NestedVRFSerializer',
  16 ]
  17 
  18 
  19 #
  20 # VRFs
  21 #
  22 
  23 class NestedVRFSerializer(WritableNestedSerializer):
  24     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vrf-detail')
  25     prefix_count = serializers.IntegerField(read_only=True)
  26 
  27     class Meta:
  28         model = models.VRF
  29         fields = ['id', 'url', 'name', 'rd', 'prefix_count']
  30 
  31 
  32 #
  33 # RIRs/aggregates
  34 #
  35 
  36 class NestedRIRSerializer(WritableNestedSerializer):
  37     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:rir-detail')
  38     aggregate_count = serializers.IntegerField(read_only=True)
  39 
  40     class Meta:
  41         model = models.RIR
  42         fields = ['id', 'url', 'name', 'slug', 'aggregate_count']
  43 
  44 
  45 class NestedAggregateSerializer(WritableNestedSerializer):
  46     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:aggregate-detail')
  47 
  48     class Meta:
  49         model = models.Aggregate
  50         fields = ['id', 'url', 'family', 'prefix']
  51 
  52 
  53 #
  54 # VLANs
  55 #
  56 
  57 class NestedRoleSerializer(WritableNestedSerializer):
  58     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:role-detail')
  59     prefix_count = serializers.IntegerField(read_only=True)
  60     vlan_count = serializers.IntegerField(read_only=True)
  61 
  62     class Meta:
  63         model = models.Role
  64         fields = ['id', 'url', 'name', 'slug', 'prefix_count', 'vlan_count']
  65 
  66 
  67 class NestedVLANGroupSerializer(WritableNestedSerializer):
  68     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlangroup-detail')
  69     vlan_count = serializers.IntegerField(read_only=True)
  70 
  71     class Meta:
  72         model = models.VLANGroup
  73         fields = ['id', 'url', 'name', 'slug', 'vlan_count']
  74 
  75 
  76 class NestedVLANSerializer(WritableNestedSerializer):
  77     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlan-detail')
  78 
  79     class Meta:
  80         model = models.VLAN
  81         fields = ['id', 'url', 'vid', 'name', 'display_name']
  82 
  83 
  84 #
  85 # Prefixes
  86 #
  87 
  88 class NestedPrefixSerializer(WritableNestedSerializer):
  89     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:prefix-detail')
  90 
  91     class Meta:
  92         model = models.Prefix
  93         fields = ['id', 'url', 'family', 'prefix']
  94 
  95 
  96 #
  97 # IP addresses
  98 #
  99 
  100 class NestedIPAddressSerializer(WritableNestedSerializer):
  101     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:ipaddress-detail')
  102 
  103     class Meta:
  104         model = models.IPAddress
  105         fields = ['id', 'url', 'family', 'address']
  106 
  107 
  108 #
  109 # Services
  110 #
  111 
  112 class NestedServiceSerializer(WritableNestedSerializer):
  113     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:service-detail')
  114 
  115     class Meta:
  116         model = models.Service
  117         fields = ['id', 'url', 'name', 'protocol', 'port']
  118
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/netbox/ipam/api/nested_serializers.py b/netbox/ipam/api/nested_serializers.py
  --- a/netbox/ipam/api/nested_serializers.py
  +++ b/netbox/ipam/api/nested_serializers.py
  @@ -44,6 +44,7 @@
   
   class NestedAggregateSerializer(WritableNestedSerializer):
       url = serializers.HyperlinkedIdentityField(view_name='ipam-api:aggregate-detail')
  +    family = serializers.IntegerField(read_only=True)
   
       class Meta:
           model = models.Aggregate
  @@ -87,6 +88,7 @@
   
   class NestedPrefixSerializer(WritableNestedSerializer):
       url = serializers.HyperlinkedIdentityField(view_name='ipam-api:prefix-detail')
  +    family = serializers.IntegerField(read_only=True)
   
       class Meta:
           model = models.Prefix
  @@ -99,6 +101,7 @@
   
   class NestedIPAddressSerializer(WritableNestedSerializer):
       url = serializers.HyperlinkedIdentityField(view_name='ipam-api:ipaddress-detail')
  +    family = serializers.IntegerField(read_only=True)
   
       class Meta:
           model = models.IPAddress
  
verification_info: {"golden_diff": "diff --git a/netbox/ipam/api/nested_serializers.py b/netbox/ipam/api/nested_serializers.py\n--- a/netbox/ipam/api/nested_serializers.py\n+++ b/netbox/ipam/api/nested_serializers.py\n@@ -44,6 +44,7 @@\n \n class NestedAggregateSerializer(WritableNestedSerializer):\n     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:aggregate-detail')\n+    family = serializers.IntegerField(read_only=True)\n \n     class Meta:\n         model = models.Aggregate\n@@ -87,6 +88,7 @@\n \n class NestedPrefixSerializer(WritableNestedSerializer):\n     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:prefix-detail')\n+    family = serializers.IntegerField(read_only=True)\n \n     class Meta:\n         model = models.Prefix\n@@ -99,6 +101,7 @@\n \n class NestedIPAddressSerializer(WritableNestedSerializer):\n     url = serializers.HyperlinkedIdentityField(view_name='ipam-api:ipaddress-detail')\n+    family = serializers.IntegerField(read_only=True)\n \n     class Meta:\n         model = models.IPAddress\n", "issue": "Swagger references IP address family incorrectly as string in NestedIPAddress.\n<!--\r\n    NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.\r\n\r\n    This form is only for reproducible bugs. If you need assistance with\r\n    NetBox installation, or if you have a general question, DO NOT open an\r\n    issue. Instead, post to our mailing list:\r\n\r\n        https://groups.google.com/forum/#!forum/netbox-discuss\r\n\r\n    Please describe the environment in which you are running NetBox. Be sure\r\n    that you are running an unmodified instance of the latest stable release\r\n    before submitting a bug report, and that any plugins have been disabled.\r\n-->\r\n### Environment\r\n* Python version: netbox-docker\r\n* NetBox version: 2.8.6\r\n\r\n<!--\r\n    Describe in detail the exact steps that someone else can take to reproduce\r\n    this bug using the current stable release of NetBox. Begin with the\r\n    creation of any necessary database objects and call out every operation\r\n    being performed explicitly. If reporting a bug in the REST API, be sure to\r\n    reconstruct the raw HTTP request(s) being made: Don't rely on a client\r\n    library such as pynetbox.\r\n-->\r\n### Steps to Reproduce\r\n1. Generate go-netbox with latest swagger https://github.com/netbox-community/go-netbox\r\n2. Attempt to pull device information with dcim.DcimDevicesListParams on a device / rack that contains a primary ip configured on an device.\r\n3. \"cannot unmarshal number into Go struct field NestedIPAddress.results.primary_ip.family of type string\"\r\n\r\n<!-- What did you expect to happen? -->\r\n### Expected Behavior\r\nSwagger to match returned data.\r\n\r\n<!-- What happened instead? -->\r\n### Observed Behavior\r\nApi returns Family as an number instead of a string, mismatching with swagger.\r\n```\r\njson: cannot unmarshal number into Go struct field NestedIPAddress.results.primary_ip.family of type string\r\n```\n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom ipam import models\nfrom utilities.api import WritableNestedSerializer\n\n__all__ = [\n    'NestedAggregateSerializer',\n    'NestedIPAddressSerializer',\n    'NestedPrefixSerializer',\n    'NestedRIRSerializer',\n    'NestedRoleSerializer',\n    'NestedServiceSerializer',\n    'NestedVLANGroupSerializer',\n    'NestedVLANSerializer',\n    'NestedVRFSerializer',\n]\n\n\n#\n# VRFs\n#\n\nclass NestedVRFSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vrf-detail')\n    prefix_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.VRF\n        fields = ['id', 'url', 'name', 'rd', 'prefix_count']\n\n\n#\n# RIRs/aggregates\n#\n\nclass NestedRIRSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:rir-detail')\n    aggregate_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.RIR\n        fields = ['id', 'url', 'name', 'slug', 'aggregate_count']\n\n\nclass NestedAggregateSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:aggregate-detail')\n\n    class Meta:\n        model = models.Aggregate\n        fields = ['id', 'url', 'family', 'prefix']\n\n\n#\n# VLANs\n#\n\nclass NestedRoleSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:role-detail')\n    prefix_count = serializers.IntegerField(read_only=True)\n    vlan_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.Role\n        fields = ['id', 'url', 'name', 'slug', 'prefix_count', 'vlan_count']\n\n\nclass NestedVLANGroupSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlangroup-detail')\n    vlan_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.VLANGroup\n        fields = ['id', 'url', 'name', 'slug', 'vlan_count']\n\n\nclass NestedVLANSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlan-detail')\n\n    class Meta:\n        model = models.VLAN\n        fields = ['id', 'url', 'vid', 'name', 'display_name']\n\n\n#\n# Prefixes\n#\n\nclass NestedPrefixSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:prefix-detail')\n\n    class Meta:\n        model = models.Prefix\n        fields = ['id', 'url', 'family', 'prefix']\n\n\n#\n# IP addresses\n#\n\nclass NestedIPAddressSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:ipaddress-detail')\n\n    class Meta:\n        model = models.IPAddress\n        fields = ['id', 'url', 'family', 'address']\n\n\n#\n# Services\n#\n\nclass NestedServiceSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:service-detail')\n\n    class Meta:\n        model = models.Service\n        fields = ['id', 'url', 'name', 'protocol', 'port']\n", "path": "netbox/ipam/api/nested_serializers.py"}], "after_files": [{"content": "from rest_framework import serializers\n\nfrom ipam import models\nfrom utilities.api import WritableNestedSerializer\n\n__all__ = [\n    'NestedAggregateSerializer',\n    'NestedIPAddressSerializer',\n    'NestedPrefixSerializer',\n    'NestedRIRSerializer',\n    'NestedRoleSerializer',\n    'NestedServiceSerializer',\n    'NestedVLANGroupSerializer',\n    'NestedVLANSerializer',\n    'NestedVRFSerializer',\n]\n\n\n#\n# VRFs\n#\n\nclass NestedVRFSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vrf-detail')\n    prefix_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.VRF\n        fields = ['id', 'url', 'name', 'rd', 'prefix_count']\n\n\n#\n# RIRs/aggregates\n#\n\nclass NestedRIRSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:rir-detail')\n    aggregate_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.RIR\n        fields = ['id', 'url', 'name', 'slug', 'aggregate_count']\n\n\nclass NestedAggregateSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:aggregate-detail')\n    family = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.Aggregate\n        fields = ['id', 'url', 'family', 'prefix']\n\n\n#\n# VLANs\n#\n\nclass NestedRoleSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:role-detail')\n    prefix_count = serializers.IntegerField(read_only=True)\n    vlan_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.Role\n        fields = ['id', 'url', 'name', 'slug', 'prefix_count', 'vlan_count']\n\n\nclass NestedVLANGroupSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlangroup-detail')\n    vlan_count = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.VLANGroup\n        fields = ['id', 'url', 'name', 'slug', 'vlan_count']\n\n\nclass NestedVLANSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlan-detail')\n\n    class Meta:\n        model = models.VLAN\n        fields = ['id', 'url', 'vid', 'name', 'display_name']\n\n\n#\n# Prefixes\n#\n\nclass NestedPrefixSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:prefix-detail')\n    family = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.Prefix\n        fields = ['id', 'url', 'family', 'prefix']\n\n\n#\n# IP addresses\n#\n\nclass NestedIPAddressSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:ipaddress-detail')\n    family = serializers.IntegerField(read_only=True)\n\n    class Meta:\n        model = models.IPAddress\n        fields = ['id', 'url', 'family', 'address']\n\n\n#\n# Services\n#\n\nclass NestedServiceSerializer(WritableNestedSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='ipam-api:service-detail')\n\n    class Meta:\n        model = models.Service\n        fields = ['id', 'url', 'name', 'protocol', 'port']\n", "path": "netbox/ipam/api/nested_serializers.py"}]}