Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZoneRecordInput omits empty name when serialized to json #451

Open
jocelynthode opened this issue Jul 3, 2024 · 2 comments
Open

ZoneRecordInput omits empty name when serialized to json #451

jocelynthode opened this issue Jul 3, 2024 · 2 comments
Labels

Comments

@jocelynthode
Copy link

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.

@weppos weppos added the triage Issues that are opened and need to be investigated. label Jul 15, 2024
@dallasread
Copy link
Member

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

@dallasread dallasread added bug and removed triage Issues that are opened and need to be investigated. labels Jul 19, 2024
@dallasread
Copy link
Member

Sorry for the slow response @jocelynthode.

For more context on why we haven't moved ahead on this yet, even though it seems simple on the surface:

If we get rid of omitempty, updating a record would zero out the record name while updating the content (if name is not supplied). To fix this would be a change of behaviour and points to an underlying design flaw in the current implementation. It would be preferable for us to require the entire hostname, instead of the smaller name attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants