dnsimple / dnsimple-python

The DNSimple API client for Python.
https://developer.dnsimple.com/
MIT License
65 stars 42 forks source link

ZoneRecordInput omits empty name when serialized to json #451

Open jocelynthode opened 5 months ago

jocelynthode commented 5 months ago

Hey, when trying to create a record at the apex I get a 400:

Reason: Bad Request
HTTP response body: {"message":"Validation failed","errors":{"name":["can't be null"]}}

Here is the code:

record = ZoneRecordInput(name="", type="CAA", ttl=60, content='0 issuewild "sectigo.com"')
client.zones.create_record(
                account_id,
                "example.com",
                record,
            )

The to_json() function removes empty fields and thus removed the name. However this field is required when using create_record making it impossible to create an apex level record.

dallasread commented 4 months ago

Thanks for pointing this out, @jocelynthode. We'll have a look!