@@ -87,7 +87,7 @@ def get_all_versions(name=None):
87
87
'/<string:name>/permissions' , methods = ['GET' , 'POST' , 'DELETE' ]
88
88
)
89
89
@blueprint .route (
90
- '/<string:name>/<string :version>/permissions' ,
90
+ '/<string:name>/<schema_version :version>/permissions' ,
91
91
methods = ['GET' , 'POST' , 'DELETE' ],
92
92
)
93
93
# @login_required
@@ -117,11 +117,9 @@ def permissions(name=None, version=None):
117
117
return jsonify ({}), 204
118
118
119
119
120
+ @blueprint .route ('/<string:name>/notifications' , methods = ['GET' , 'PATCH' ])
120
121
@blueprint .route (
121
- '/<string:name>/notifications' , methods = ['GET' , 'PATCH' ]
122
- )
123
- @blueprint .route (
124
- '/<string:name>/<string:version>/notifications' ,
122
+ '/<string:name>/<schema_version:version>/notifications' ,
125
123
methods = ['GET' , 'PATCH' ],
126
124
)
127
125
@get_schema
@@ -130,30 +128,36 @@ def permissions(name=None, version=None):
130
128
def notifications_config (name = None , version = None , schema = None , * args , ** kwargs ):
131
129
"""CRUD operations for schema configuration."""
132
130
serialized_config = schema .config_serialize ()
133
- notifications_config = serialized_config .get ("config" , {}).get ("notifications" , {})
131
+ notifications_config = serialized_config .get ("config" , {}).get (
132
+ "notifications" , {}
133
+ )
134
134
if request .method == "PATCH" :
135
135
try :
136
136
data = request .get_json ()
137
- patched_notifications_config = apply_patch (notifications_config , data )
138
- patched_object = {'config' : {'notifications' : patched_notifications_config }}
137
+ patched_notifications_config = apply_patch (
138
+ notifications_config , data
139
+ )
140
+ patched_object = {
141
+ 'config' : {'notifications' : patched_notifications_config }
142
+ }
139
143
schema .update (** patched_object )
140
144
db .session .commit ()
141
145
return jsonify (schema .config_serialize ()), 201
142
146
except (
143
- JsonPatchException ,
144
- JsonPatchConflict ,
145
- JsonPointerException ,
146
- TypeError ,
147
- ) as err :
148
- return (
149
- jsonify (
150
- {
151
- 'message' : 'Could not apply '
152
- 'json-patch to object: {}' .format (err )
153
- }
154
- ),
155
- 400 ,
156
- )
147
+ JsonPatchException ,
148
+ JsonPatchConflict ,
149
+ JsonPointerException ,
150
+ TypeError ,
151
+ ) as err :
152
+ return (
153
+ jsonify (
154
+ {
155
+ 'message' : 'Could not apply '
156
+ 'json-patch to object: {}' .format (err )
157
+ }
158
+ ),
159
+ 400 ,
160
+ )
157
161
except IntegrityError :
158
162
return (
159
163
jsonify (
@@ -401,7 +405,7 @@ def patch(self, name, version):
401
405
],
402
406
)
403
407
blueprint .add_url_rule (
404
- '/<string:name>/<string :version>' ,
408
+ '/<string:name>/<schema_version :version>' ,
405
409
view_func = schema_view_func ,
406
410
methods = ['GET' , 'PUT' , 'DELETE' , 'PATCH' ],
407
411
)
0 commit comments