Skip to content

Commit

Permalink
Fix docs build
Browse files Browse the repository at this point in the history
The *serializer_base_classes does not work with Griffe
  • Loading branch information
smk4664 committed Oct 17, 2024
1 parent 6cd5413 commit 8ae6698
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,6 @@ docker-compose.override.yml
override.env
invoke.yml
*.dccache

# Static docs
/nautobot_device_lifecycle_mgmt/static/nautobot_device_lifecycle_mgmt/docs/
66 changes: 51 additions & 15 deletions nautobot_device_lifecycle_mgmt/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@
NestedSoftwareLCMSerializer,
)

serializer_base_classes = [

class HardwareLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
] # pylint: disable=invalid-name


class HardwareLCMSerializer(*serializer_base_classes): # pylint: disable=R0901,too-few-public-methods
): # pylint: disable=R0901,too-few-public-methods
"""API serializer."""

url = serializers.HyperlinkedIdentityField(
Expand Down Expand Up @@ -75,7 +73,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class ProviderLCMSerializer(*serializer_base_classes): # pylint: disable=R0901,too-few-public-methods
class ProviderLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=R0901,too-few-public-methods
"""API serializer."""

url = serializers.HyperlinkedIdentityField(
Expand All @@ -102,7 +104,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class ContractLCMSerializer(*serializer_base_classes): # pylint: disable=R0901,too-few-public-methods
class ContractLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=R0901,too-few-public-methods
"""API serializer."""

url = serializers.HyperlinkedIdentityField(
Expand Down Expand Up @@ -131,7 +137,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class ContactLCMSerializer(*serializer_base_classes): # pylint: disable=R0901,too-few-public-methods
class ContactLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=R0901,too-few-public-methods
"""API serializer."""

url = serializers.HyperlinkedIdentityField(
Expand All @@ -157,7 +167,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class SoftwareLCMSerializer(*serializer_base_classes): # pylint: disable=too-few-public-methods
class SoftwareLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=too-few-public-methods
"""REST API serializer for SoftwareLCM records."""

url = serializers.HyperlinkedIdentityField(
Expand Down Expand Up @@ -192,7 +206,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class SoftwareImageLCMSerializer(*serializer_base_classes): # pylint: disable=too-few-public-methods
class SoftwareImageLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=too-few-public-methods
"""REST API serializer for SoftwareImageLCM records."""

url = serializers.HyperlinkedIdentityField(
Expand Down Expand Up @@ -221,7 +239,11 @@ class Meta: # pylint: disable=too-few-public-methods
]


class ValidatedSoftwareLCMSerializer(*serializer_base_classes): # pylint: disable=too-few-public-methods
class ValidatedSoftwareLCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=too-few-public-methods
"""REST API serializer for ValidatedSoftwareLCM records."""

url = serializers.HyperlinkedIdentityField(
Expand Down Expand Up @@ -251,7 +273,12 @@ class Meta: # pylint: disable=too-few-public-methods
]


class CVELCMSerializer(*serializer_base_classes, StatusModelSerializerMixin): # pylint: disable=abstract-method
class CVELCMSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
StatusModelSerializerMixin,
): # pylint: disable=abstract-method
"""REST API serializer for CVELCM records."""

url = serializers.HyperlinkedIdentityField(view_name="plugins-api:nautobot_device_lifecycle_mgmt-api:cvelcm-detail")
Expand Down Expand Up @@ -282,7 +309,10 @@ class Meta:


class VulnerabilityLCMSerializer(
*serializer_base_classes, StatusModelSerializerMixin
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
StatusModelSerializerMixin,
): # pylint: disable=abstract-method
"""REST API serializer for VulnerabilityLCM records."""

Expand Down Expand Up @@ -321,7 +351,11 @@ class Meta:
]


class DeviceSoftwareValidationResultSerializer(*serializer_base_classes): # pylint: disable=too-few-public-methods
class DeviceSoftwareValidationResultSerializer(
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=too-few-public-methods
"""REST API serializer for DeviceSoftwareValidationResult records."""

url = serializers.HyperlinkedIdentityField(
Expand All @@ -346,7 +380,9 @@ class Meta: # pylint: disable=too-few-public-methods


class InventoryItemSoftwareValidationResultSerializer(
*serializer_base_classes
RelationshipModelSerializerMixin,
TaggedObjectSerializer,
CustomFieldModelSerializer,
): # pylint: disable=too-few-public-methods
"""REST API serializer for InventoryItemSoftwareValidationResult records."""

Expand Down
Loading

0 comments on commit 8ae6698

Please sign in to comment.