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

[Schema Inaccuracy] git-tree schema has no required properties #3833

Open
rpmccarter opened this issue Aug 8, 2024 · 0 comments
Open

[Schema Inaccuracy] git-tree schema has no required properties #3833

rpmccarter opened this issue Aug 8, 2024 · 0 comments

Comments

@rpmccarter
Copy link

rpmccarter commented Aug 8, 2024

Schema Inaccuracy

The tree property in the git-tree schema has no required fields. I believe this is inaccurate.

Additionally, the example field of the tree property appears to have incorrect data, as it includes a properties field and a required field. I'm guessing these were mistakenly copy/pasted at some point. My guess is that the required field from the example was intended to be in the tree property, making those fields required.

This matters to me because the downstream @octokit/openapi-types package that is generated from this definition lists every property as optional, forcing me to check for the existence of every single property on every single node.

Expected

  1. The path, mode, type, and sha fields should be required on the git-tree schema. (size appears to be absent on directories and submodules, and url appears to be absent on submodules)
  2. The properties and required fields should be removed from the git-tree schema's example.

Also, if you're feeling generous, you can update the types of type and mode to be enums, as laid out in #229 - it's the same exact schema!

Reproduction Steps

It's tough to prove that these properties will always be present, but I created this repo with every possible node type/mode combination, at least according to these docs. If you curl the tree for this repo, you'll see that every tree node has the path, mode, type and sha properties.

curl https://api.github.com/repos/rpmccarter/every-node-type/git/trees/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants