Skip to content

Commit

Permalink
draft/wip set artifact field as not required
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Apr 23, 2024
1 parent d975a4f commit 921c898
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions pulp_container/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import re

from django.core.validators import URLValidator
from drf_spectacular.utils import extend_schema_field
from rest_framework import serializers

from pulpcore.app.serializers import fields
from pulpcore.plugin.models import (
Artifact,
ContentRedirectContentGuard,
Expand Down Expand Up @@ -120,27 +122,36 @@ class Meta:
model = models.Manifest


class ConfigBlobSerializer(NoArtifactContentSerializer):
"""
Serializer for Blobs without artifacts (ConfigBlob).
"""

digest = serializers.CharField(help_text="sha256 of the Blob file")

class Meta:
fields = NoArtifactContentSerializer.Meta.fields + ("digest",)
model = models.Blob

class BlobSerializer(SingleArtifactContentSerializer):
"""
Serializer for Blobs.
"""

digest = serializers.CharField(help_text="sha256 of the Blob file")
artifact = fields.SingleContentArtifactField(
help_text=_("Artifact file representing the physical content"),
required = False
)

#@extend_schema_field(ConfigBlobSerializer)
#def get_artifact(self, object):
# return object

class Meta:
fields = SingleArtifactContentSerializer.Meta.fields + ("digest",)
model = models.Blob

#class ConfigBlobSerializer(NoArtifactContentSerializer):
# """
# Serializer for Blobs without artifacts (ConfigBlob).
# """
#
# digest = serializers.CharField(help_text="sha256 of the Blob file")
#
# class Meta:
# fields = NoArtifactContentSerializer.Meta.fields + ("digest",)
# model = models.Blob

class ManifestSignatureSerializer(NoArtifactContentSerializer):
"""
Expand Down

0 comments on commit 921c898

Please sign in to comment.