TypeError raised when WritableNestedSerializer receives a non-integer value #1920

Closed
opened 2025-12-29 17:20:34 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 8, 2018).

Environment

  • Python version: 3.5.6
  • NetBox version: 2.4.2

Steps to Reproduce

Example API request:

curl -X POST \
-H "Authorization: Token <TOKEN>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://localhost:8000/api/dcim/sites/ \
--data '{"name": "Test Site 2", "slug": "test-site-2", "region": {"name": "foo"}}'

Expected Behavior

The above request should generate a validation error, which can be handled elegantly by the client.

Observed Behavior

A TypeError exception is raised.

Originally created by @jeremystretch on GitHub (Aug 8, 2018). ### Environment * Python version: 3.5.6 * NetBox version: 2.4.2 ### Steps to Reproduce Example API request: ``` curl -X POST \ -H "Authorization: Token <TOKEN>" \ -H "Content-Type: application/json" \ -H "Accept: application/json; indent=4" \ http://localhost:8000/api/dcim/sites/ \ --data '{"name": "Test Site 2", "slug": "test-site-2", "region": {"name": "foo"}}' ``` ### Expected Behavior The above request should generate a validation error, which can be handled elegantly by the client. ### Observed Behavior A `TypeError` exception is raised.
adam added the type: bugstatus: accepted labels 2025-12-29 17:20:34 +01:00
adam closed this issue 2025-12-29 17:20:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1920