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

Improve Documentation with Nullable #1095

Open
sudosubin opened this issue Aug 1, 2023 · 4 comments
Open

Improve Documentation with Nullable #1095

sudosubin opened this issue Aug 1, 2023 · 4 comments

Comments

@sudosubin
Copy link

Objects represented via describe_object may have fields that are nullable.

Depending on the programming language (Python has None, TypeScript has null, Go has nil, etc) there are cases where this nullability is important, so it would be nice if nullable fields are well documented.

@chadlwilson
Copy link
Member

Can you give a specific example of an API and fields you are talking about?

In general it seems basically none of the API docs go to the detail of saying which fields are always there, sometimes there and such.

@sudosubin
Copy link
Author

For example, artifact config object's purge_settings could be null, and material attributes could hae null properties. (name, destination, filter, else)

Sometimes the field didn't exist at all and was parsed as null. I'm using python's pydantic for parsing the response, and pydantic actually works like this.

@chadlwilson
Copy link
Member

I must confess that it's such an immense undertaking given the # of APIs and having to go back to first principles to figure it out - that I wouldn't know where to start (but agree with its usefulness and that it's a good practice that'd be required if, say, publishing a more technical API specification like an OpenAPI spec).

If there are some you have seen where it is documented, we could perhaps use that as a pattern to follow and start doing pieces incrementally.

@sudosubin
Copy link
Author

Ideally, I believe that documentation should be generated automatically from code to reduce operation costs and be more accurate. (Using OpenAPI also helps auto-generate the client code.) However, it will be difficult to migrate because api.go.cd also has agent documentation and has a large amount of APIs.

If we take a light approach, after deciding how to display nullable properties as above coment, I think me and other contributors can fill in the missing details.

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

No branches or pull requests

2 participants