1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00

Support 202110 (#1085)

* Block registering private ASN ranges

* Add a continental region field for facilities #1007

* Incorrect order of search results #232

* Allow users to upload a small logo to their record #346

* Sponsor badge CSS and text translation issues #453

* IXP and Facility summary #18

* Add sales email and phone contact to ix object #949

* Increase timeout timer for IX-F JSON importer to 30s #962

* IX-F manually triggered import bugs #1054

* remove survey notifications

* IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807

* performance fix for net view

* api documentation generate broken #956

* fix poc set missing from net view

* Auto focus cursor on search field on main website #695

* PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748

* Delete childless org objects #838

* linting

* poetry lock

* re-add mistakingly dropped translation to email template

* fix template variables

* regen docs

* regen api docs

* fix merge cruft

* django-peeringdb to 2.11 and poetry relock

* linting

* comment out django-peeringdb volume mount

* add missing declaration

Co-authored-by: Stefan Pratter <stefan@20c.com>
Co-authored-by: David Poarch <dpoarch@20c.com>
This commit is contained in:
Matt Griswold
2021-11-09 09:47:38 -06:00
committed by GitHub
parent 1eda45ffeb
commit 8ef76dc5ab
76 changed files with 24235 additions and 24048 deletions

View File

@@ -86,7 +86,7 @@ class BaseSchema(AutoSchema):
return method.lower()
def _get_operation_id(self, path, method):
def get_operation_id(self, path, method):
"""
Override this so operation ids become "{op} {reftag}"
"""
@@ -95,9 +95,19 @@ class BaseSchema(AutoSchema):
op_type = self.get_operation_type(path, method)
if model:
# Overrides for duplicate operations ids
if "request_ixf_import" in path:
return f"{op_type} IX-F import request"
elif "as_set/{asn}" in path:
return f"{op_type} as-set by asn"
elif "as_set" in path:
return f"{op_type} as-set"
return f"{op_type} {model.HandleRef.tag}"
return super()._get_operation_id(path, method)
return super().get_operation_id(path, method)
def get_operation(self, *args, **kwargs):
@@ -122,6 +132,17 @@ class BaseSchema(AutoSchema):
serializer, model = self.get_classes(*args)
# Override the the requestBody with components instead of using reference
components = super().get_components(*args).get(model.__name__)
content_types = [
"application/json",
]
# Override schema for create, update and patch operations
if components and op_type in ["create", "update", "patch"]:
for content_type in content_types:
op_dict["requestBody"]["content"][content_type]["schema"] = components
# if we were able to get a model we want to include the markdown documentation
# for the model type in the openapi description field (docs/api/obj_*.md)
@@ -135,7 +156,6 @@ class BaseSchema(AutoSchema):
# check if we have an augmentation method set for the operation_type and object type
# combination, if so run it
augment = getattr(self, f"augment_{op_type}_{model.HandleRef.tag}", None)
if augment:
augment(serializer, model, op_dict)
@@ -540,9 +560,6 @@ class BaseSchema(AutoSchema):
# prefix on `update` will be ignored
del properties["prefix"]
# suggest on `update` will be ignored
del properties["suggest"]
def augment_update_fac(self, serializer, model, op_dict):
"""
Augment openapi schema for update fac operation.