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

zone: make Owner fields optional #232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomasqueirozb
Copy link

@thomasqueirozb thomasqueirozb commented Jan 19, 2024

According to the docs id and name are not required and email isn't even mentioned. My request had id and email as null, which broke deserialization

      "owner": { "id": null, "type": "user", "email": null },

The correct thing to do would be to make these fields Option<String> but I didn't do so in order not to break the api. Had to convert the fields to Option, which breaks the public API, but I doubt anyone is using the Owner struct tbh.

This is also how the go implementation does it too:

https://github.com/cloudflare/cloudflare-go/blob/325729d2e358cd3f300c130cfa828e5704e725d8/zone.go#L24-L29

If any of the fields are null, the go json library will just make that field an empty string.

@thomasqueirozb thomasqueirozb changed the title zone: make Owner have default values zone: make Owner fields optional Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant