-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added missing fields for deployments API #2560
Conversation
Note: there is a test that checks Assert.Equal("topic-branch", actual.Sha); but Also, I am wondering why all URLs are parsed as |
Hi @hansmbakker, thanks for the PR! Please feel free to fix any tests that you think look a bit odd! I'm not sure if it's a requirement of the de-serializer but URLs are always strings here. This is something we could look into when we move to auto-generated models. |
@JonruAlveus it is not a requirement, I already have them working with |
@JonruAlveus In general the response from the API in practice seems to have changed a bit since the test was written. For me, the |
Also: what C# / dotnet versions are OK to be used in the tests? |
Co-authored-by: Chris Simpson <[email protected]>
Update test projects
…ker/octokit.net into feature/deployments-api
|
/// <summary> | ||
/// The name of the ref. This can be a branch, tag, or SHA. | ||
/// </summary> | ||
public string Ref { get; protected set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @hansmbakker, Thanks for the change set here! ❤️ It looks like @JonruAlveus already has you covered on the review front. I did want to highlight that as we've been modifying these models, we've been updating the property accessors to be the more appropriate private
instead of protected
.
There is no way you would've known this unless you've watched the PRs over the past few months. I've got an incoming PR that has done a sweep to unify all of our Response models under this approach - just giving you a heads up here in case you wanted to change this one as well. Not a blocker, though.
Thanks again for the changes.
public string Ref { get; protected set; } | |
public string Ref { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickfloyd should it not be { get; init; }
then since they are only set in the constructor?
And with that, should those models not be record
s rather than class
es?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @hansmbakker { get; init; }
would certainly be a much more semantically rich way to write this, but we cannot make that jump just yet for 2 reasons:
- We're using c# 7.3, and init is only supported in >= 9.x
- In the hydration logic for the SDKs for incoming responses uses reflection that expects a certain structure. Until we're ready to rewrite those things we'll need to drive to consistency incrementally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickfloyd thanks for the explanation.
With that - #2562 would be beneficial for several reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansmbakker, I 100% agree. I look forward to working as a community to drive changes like your suggested. Certain things just can't / shouldn't be generated, and whatever we can use to drive down complexity would be a win for this SDK! ❤️
@JonruAlveus @nickfloyd thank you for the feedback - I have one open question left, could you help me with it? Is it ok for me to use |
For reference: #2565 |
While we are driving toward consistency, I'd recommend sticking with Given that, I'll leave the decision up to you. Either way, we'll be able to work with it, and I don't want to block your solid changes here over a semantic speed bump. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ❤️
@nickfloyd thank you! I switched protected set to private set and will leave the uris as String now. @JonruAlveus could you please review this? |
release_notes: Adds missing fields for deployments API |
The Deployments API is missing these fields:
ref
environment
original_environment
This PR adds them.
They are documented at https://docs.github.com/en/rest/deployments/deployments#list-deployments.