Repository navigation
allow operators to override the sled-add prechecks #11638
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a166dd1
Allow operators to override the sled-add prechecks
davepacheco a3e6c84
Merge branch 'dap/add-sled-check-2' into dap/add-sled-check-3
davepacheco 69190b5
review feedback
davepacheco 198da03
fix
davepacheco 7142d62
defaults are not so bad
davepacheco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| //! Version `SLED_ADD_PRECHECK_OVERRIDES` of the Nexus external API. | ||
| //! | ||
| //! Adds `override_prechecks` to the request to add sleds to a rack. | ||
|
|
||
| pub mod rack; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think I picked this up from you a long time ago - should we use a more descriptive name than
defaulthere?SledAddPrecheckOverrides::none()orSledAddPrecheckOverrides::no_overrides()or something like that?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.
holy smokes: @davepacheco using "default"!?!?!
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.
Yeah, I wasn't super excited about this. I can get behind default when it's super clear what the semantics are (like maybe for
i32), or when the default can't reasonably be computed by the caller (like the default path to store user configuration, which varies from system to system), or when it's very unusual to need to change it (like in this case, hopefully). I like the idea of not impl'ingDefaulton the type and using something likeno_overrides(), but it seemed wrong at the API level to make people write out that they're not overriding anything. The natural way to let them leave that out is to implDefaulton this type. But I could as well use the serde annotation to get the default from a helper, though. I don't have a strong feeling either way here.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.
I went down this path, but I think using
#[serde(default = ...)]instead of#[serde(default)]might have the side effect that users of generated clients have to provide these fields instead of getting a default? That seems meaningfully worse to me. What do you think @jgallagher @ahl?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.
That... seems terrible and not at all what I'd expect. Is that because the default only applies to deserialization and doesn't make it to the OpenAPI spec?
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.
I didn't poke too hard at it, to be honest. 7142d62 is the commit in which I undid this. In the "before", it was using
#[serde(default = ...)]. Nothing about the default value for this top-level field makes it into the OpenAPI document. That's also true in the "after" version with#[serde(default)], but the difference is that the individual boolean fields themselves have default values and those do make it into the OpenAPI document. Since these are plain objects, I imagine a client can infer that they can construct the whole struct from the defaults, but I'm not sure if that happens in practice or if that's technically implied by the spec.