aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-04-06 08:56:01 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-04-06 08:56:01 +0800
commit108962b26dc272edab0172852b00dd55f9947f62 (patch)
tree4e18f22284b664398eb3fb44badbbef0f0efdab1
parent7bf3c0f9eb53bd37980d62c72612b4c39a1c6029 (diff)
Update serializer for catalog
Change-Id: Ic1e5b0b3ee15f0d0ddac136a7278708859971436 Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--catalog/packages/serializers/nsdm_subscription.py27
-rw-r--r--catalog/packages/serializers/response.py32
-rwxr-xr-xcatalog/packages/serializers/subscription_auth_data.py24
3 files changed, 60 insertions, 23 deletions
diff --git a/catalog/packages/serializers/nsdm_subscription.py b/catalog/packages/serializers/nsdm_subscription.py
index c96c0296..dabd606a 100644
--- a/catalog/packages/serializers/nsdm_subscription.py
+++ b/catalog/packages/serializers/nsdm_subscription.py
@@ -22,7 +22,8 @@ from nsdm_filter_data import NsdmNotificationsFilter
class NsdmSubscriptionLinkSerializer(serializers.Serializer):
self = LinkSerializer(
help_text="Links to resources related to this resource.",
- required=True)
+ required=True
+ )
class NsdmSubscriptionSerializer(serializers.Serializer):
@@ -30,19 +31,23 @@ class NsdmSubscriptionSerializer(serializers.Serializer):
help_text="Identifier of this subscription resource.",
max_length=255,
required=True,
- allow_null=False)
+ allow_null=False
+ )
callbackUri = serializers.CharField(
help_text="The URI of the endpoint to send the notification to.",
max_length=255,
required=True,
- allow_null=False)
+ allow_null=False
+ )
filter = NsdmNotificationsFilter(
help_text="Filter settings for this subscription, to define the "
"of all notifications this subscription relates to.",
- required=False)
+ required=False
+ )
_links = NsdmSubscriptionLinkSerializer(
help_text="Links to resources related to this resource.",
- required=True)
+ required=True
+ )
class NsdmSubscriptionsSerializer(serializers.ListSerializer):
@@ -53,23 +58,27 @@ class NsdmSubscriptionIdSerializer(serializers.Serializer):
subscription_id = serializers.UUIDField(
help_text="Identifier of this subscription resource.",
required=True,
- allow_null=False)
+ allow_null=False
+ )
class NsdmSubscriptionRequestSerializer(serializers.Serializer):
callbackUri = serializers.CharField(
help_text="The URI of the endpoint to send the notification to.",
required=True,
- allow_null=False)
+ allow_null=False
+ )
filter = NsdmNotificationsFilter(
help_text="Filter settings for the subscription,"
" to define the subset of all "
"notifications this subscription relates to.",
required=False,
- allow_null=True)
+ allow_null=True
+ )
authentication = SubscriptionAuthenticationSerializer(
help_text="Authentication parameters to configure"
" the use of Authorization when sending "
"notifications corresponding to this subscription.",
required=False,
- allow_null=True)
+ allow_null=True
+ )
diff --git a/catalog/packages/serializers/response.py b/catalog/packages/serializers/response.py
index 449d0622..e2cca920 100644
--- a/catalog/packages/serializers/response.py
+++ b/catalog/packages/serializers/response.py
@@ -16,16 +16,36 @@ from rest_framework import serializers
class ProblemDetailsSerializer(serializers.Serializer):
- type = serializers.CharField(help_text="Type", required=False, allow_null=True)
- title = serializers.CharField(help_text="Title", required=False, allow_null=True)
- status = serializers.IntegerField(help_text="Status", required=True)
- detail = serializers.CharField(help_text="Detail", required=True, allow_null=True)
- instance = serializers.CharField(help_text="Instance", required=False, allow_null=True)
+ type = serializers.CharField(
+ help_text="Type",
+ required=False,
+ allow_null=True
+ )
+ title = serializers.CharField(
+ help_text="Title",
+ required=False,
+ allow_null=True
+ )
+ status = serializers.IntegerField(
+ help_text="Status",
+ required=True
+ )
+ detail = serializers.CharField(
+ help_text="Detail",
+ required=True,
+ allow_null=True
+ )
+ instance = serializers.CharField(
+ help_text="Instance",
+ required=False,
+ allow_null=True
+ )
additional_details = serializers.ListField(
help_text="Any number of additional attributes, as defined in a "
"specification or by an implementation.",
required=False,
- allow_null=True)
+ allow_null=True
+ )
class Meta:
ref_name = 'SUBSCRIPTION_ProblemDetailsSerializer'
diff --git a/catalog/packages/serializers/subscription_auth_data.py b/catalog/packages/serializers/subscription_auth_data.py
index 5d40e4d3..bf512d66 100755
--- a/catalog/packages/serializers/subscription_auth_data.py
+++ b/catalog/packages/serializers/subscription_auth_data.py
@@ -23,19 +23,22 @@ class OAuthCredentialsSerializer(serializers.Serializer):
"request of the OAuth 2.0 client credentials grant type.",
required=False,
max_length=255,
- allow_null=False)
+ allow_null=False
+ )
clientPassword = serializers.CharField(
help_text="Client password to be used in the access token "
"request of the OAuth 2.0 client credentials grant type.",
required=False,
max_length=255,
- allow_null=False)
+ allow_null=False
+ )
tokenEndpoint = serializers.CharField(
help_text="The token endpoint from which the access token can "
"be obtained.",
required=False,
max_length=255,
- allow_null=False)
+ allow_null=False
+ )
class BasicAuthSerializer(serializers.Serializer):
@@ -43,12 +46,14 @@ class BasicAuthSerializer(serializers.Serializer):
help_text="Username to be used in HTTP Basic authentication.",
max_length=255,
required=False,
- allow_null=False)
+ allow_null=False
+ )
password = serializers.CharField(
help_text="Password to be used in HTTP Basic authentication.",
max_length=255,
required=False,
- allow_null=False)
+ allow_null=False
+ )
class SubscriptionAuthenticationSerializer(serializers.Serializer):
@@ -57,13 +62,16 @@ class SubscriptionAuthenticationSerializer(serializers.Serializer):
help_text="Defines the types of Authentication / Authorization "
"which the API consumer is willing to accept when "
"receiving a notification.",
- required=True)
+ required=True
+ )
paramsBasic = BasicAuthSerializer(
help_text="Parameters for authentication/authorization using BASIC.",
required=False,
- allow_null=False)
+ allow_null=False
+ )
paramsOauth2ClientCredentials = OAuthCredentialsSerializer(
help_text="Parameters for authentication/authorization using "
"OAUTH2_CLIENT_CREDENTIALS.",
required=False,
- allow_null=False)
+ allow_null=False
+ )