From 1ce0191a744231bf7b04a65a4625a4f2ed7330b2 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Wed, 15 Apr 2020 01:02:11 -0400 Subject: [PATCH] Fixes #4361: Set correct type of connection_state --- docs/release-notes/version-2.8.md | 1 + netbox/utilities/custom_inspectors.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index 0b0539c02..76c46e944 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -4,6 +4,7 @@ ### Bug Fixes +* [#4361](https://github.com/netbox-community/netbox/issues/4361) - Fix Type of `connection_state` in swagger schema. * [#4489](https://github.com/netbox-community/netbox/issues/4489) - Fix display of parent/child role on device type view --- diff --git a/netbox/utilities/custom_inspectors.py b/netbox/utilities/custom_inspectors.py index 25764b0be..2cbe1cfc5 100644 --- a/netbox/utilities/custom_inspectors.py +++ b/netbox/utilities/custom_inspectors.py @@ -92,7 +92,7 @@ class CustomChoiceFieldInspector(FieldInspector): value_schema = openapi.Schema(type=schema_type, enum=choice_value) value_schema['x-nullable'] = True - if isinstance(choice_value[0], int): + if all(type(x) == int for x in [c for c in choice_value if c is not None]): # Change value_schema for IPAddressFamilyChoices, RackWidthChoices value_schema = openapi.Schema(type=openapi.TYPE_INTEGER, enum=choice_value)