-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add conversion methods from schema to hcloud objects (#343)
This PR adds automatic generation of schema conversion methods in `schema.go` with [goverter](https://github.com/jmattheis/goverter). Previously, `schema.go` was manually written. This is a tedious task and is also prone to errors. This PR also adds new methods to convert `hcloud` objects back into schemas. This allows for round trip testing (converting `schema -> hcloud -> schema` or `hcloud -> schema -> hcloud` and testing for equality) and allows for removal of redundant code in [hcloud/cli](https://github.com/hetznercloud/cli). Since the round trip tests ensure that a schema converts into an `hcloud` object and back, formatting will be consistent between conversions. This would fix issues like hetznercloud/cli#461.
- Loading branch information
Showing
11 changed files
with
4,171 additions
and
2,681 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
hcloud/zz_*_iface.go linguist-generated=true | ||
hcloud/zz_*.go linguist-generated=true |
This file contains 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 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 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 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
Oops, something went wrong.