We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug https://developer.github.com/v3/git/trees/#create-a-tree allows content field or sha field. You could not use both but you could send sha with null value if you populated the content field
content
sha
https://developer.github.com/enterprise/2.16/v3/git/trees/
The SHA1 checksum ID of the object in the tree. Also called tree.sha. Note: Use either tree.sha or content to specify the contents of the entry. Using both tree.sha and content will return an error.
The SHA1 checksum ID of the object in the tree. Also called tree.sha.
Note: Use either tree.sha or content to specify the contents of the entry. Using both tree.sha and content will return an error.
With 2.17+ API's https://developer.github.com/enterprise/2.17/v3/git/trees/
The SHA1 checksum ID of the object in the tree. Also called tree.sha. If the value is null then the file will be deleted. Note: Use either tree.sha or content to specify the contents of the entry. Using both tree.sha and content will return an error.
The SHA1 checksum ID of the object in the tree. Also called tree.sha. If the value is null then the file will be deleted.
In the library a sha field is always sent with null value even if we choose to just send the content field because of serialization of the TreeEntry fields. https://github.com/github-api/github-api/blob/d1507f26668950508e0bf242c34cdb599003991a/src/main/java/org/kohsuke/github/GHTreeBuilder.java#L24
To Reproduce
The curl equivalent is:
curl -X POST \ https://github.com/api/v3/repos/org/repo/git/trees \ -H 'Authorization: token <>' \ -H 'Content-Type: application/json' \ -d '{ "base_tree": "base_sha", "tree": [ { "path": "somePath", "mode": "100644", "type": "blob", "sha": null, "content": "someText" } ] }'
Expected behavior Tree must be created but instead we see:
{ "message": "Must supply tree.sha or tree.content", "documentation_url": "https://developer.github.com/enterprise/2.18/v3/git/trees/#create-a-tree" }
Desktop (please complete the following information): Latest version
Additional context
Adding a @JsonInclude(Include.NON_NULL) in https://github.com/github-api/github-api/blob/d1507f26668950508e0bf242c34cdb599003991a/src/main/java/org/kohsuke/github/GHTreeBuilder.java#L20 will fix the issue according to me
@JsonInclude(Include.NON_NULL)
@JsonInclude(Include.NON_NULL) private static final class TreeEntry { private final String path; private final String mode; private final String type; private String sha; private String content; private TreeEntry(String path, String mode, String type) { this.path = path; this.mode = mode; this.type = type; } }
The text was updated successfully, but these errors were encountered:
Suggested changes #642
Sorry, something went wrong.
Method is deprecated. So closing this.
Fixed in #642.
No branches or pull requests
Describe the bug
https://developer.github.com/v3/git/trees/#create-a-tree allows
content
field orsha
field. You could not use both but you could sendsha
with null value if you populated the content fieldhttps://developer.github.com/enterprise/2.16/v3/git/trees/
With 2.17+ API's
https://developer.github.com/enterprise/2.17/v3/git/trees/
In the library a
sha
field is always sent with null value even if we choose to just send thecontent
field because of serialization of the TreeEntry fields.https://github.com/github-api/github-api/blob/d1507f26668950508e0bf242c34cdb599003991a/src/main/java/org/kohsuke/github/GHTreeBuilder.java#L24
To Reproduce
The curl equivalent is:
Expected behavior
Tree must be created but instead we see:
Desktop (please complete the following information):
Latest version
Additional context
Adding a
@JsonInclude(Include.NON_NULL)
in https://github.com/github-api/github-api/blob/d1507f26668950508e0bf242c34cdb599003991a/src/main/java/org/kohsuke/github/GHTreeBuilder.java#L20 will fix the issue according to meThe text was updated successfully, but these errors were encountered: