Bug in flarectl, Cloudflare API docs, cloudflare-go and cloudflare-rs
https://developers.cloudflare.com/api/operations/zones-get
Owner should always have email, id and type as strings, however my response was:
https://github.com/cloudflare/cloudflare-rs/blob/b4fa5ef8bb48415c54974ee3ed11cf9d8397d98b/cloudflare/src/endpoints/zone.rs#L111-L114
Rust API says that owner is either "user" (with id and email, both of which are always present) or "organization" (with id and name, both of which are always present). According to the api docs, email should never be present
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
GitHub
cloudflare-rs/cloudflare/src/endpoints/zone.rs at b4fa5ef8bb48415c5...
Rust library for the Cloudflare v4 API. Contribute to cloudflare/cloudflare-rs development by creating an account on GitHub.
11 Replies
Something is definitely wrong here.
1. Docs should include email (or make the owner field a variant that is either of type "user" or type "organization")
2. Maybe there is a bug in the API making it return nulls for the owner's email and id
3. If there isn't a bug in the API, then the docs and the Rust enum should reflect that these fields are optional
Other than cloudflare-go, I'd say that the SDKs aren't maintained so I doubt it'll be fixed any time soon (if there is an issue with it)
Should also be a problem with the go implementation but I'm not sure (not proficient in go). Either way the docs should include email.
https://github.com/cloudflare/cloudflare-go/blob/master/zone.go#L24-L29
EDIT: just checked the go implementation and the result ends up being
{"id":"","email":"","name":"","type":"user"}
I installed flarectl just like the README (https://github.com/cloudflare/cloudflare-go/tree/master/cmd/flarectl) told me to (
go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latest
) to investigate this issue and the zone command wouldn't run since the alias for create
and cert
were the same. Had to delete the following to get it to work:
After applying my patch and running flarectl zone list
I got my zone id and then I ran flarectl zone info --zone myzoneid
which gave me this:
GitHub
cloudflare-go/cmd/flarectl at master · cloudflare/cloudflare-go
Go library for the Cloudflare v4 API. Contribute to cloudflare/cloudflare-go development by creating an account on GitHub.
Can you add this to https://github.com/cloudflare/cloudflare-go/issues/1465
will do as soon as I find out why the info command doesn't work
GitHub
flarectl: fix duplicate alias in zone subcommand by thomasqueirozb ...
Fixes: #1465
Description
check and certs were both aliased to "c". Changed certs alias from "c" to "ct".
This would've been way more easier to debug if a log were ...
I messed up. The
flarectl zone info
command works with the zone name not the id. Just wasted an hour 🙂Created a PR "fixing" this in the rust implementation but I doubt it will be merged anytime soon 😦
https://github.com/cloudflare/cloudflare-rs/pull/232
GitHub
zone: make Owner have default values by thomasqueirozb · Pull Reque...
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": nu...
Docs are still wrong but idk how I'd even report that
There is a feedback button in the bottom left on the api docs page to report these type of issues