-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat: add conversion methods from schema to hcloud objects #343
Conversation
4fbf0f6
to
74c1bd4
Compare
047a226
to
701f381
Compare
@jmattheis Feel free to leave some feedback here 🙂 Maybe something can be done better/more efficiently than how I did it |
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.
The goverter usage looks good to me. I've added two "maybe" improvements as comments.
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | golang.org/x/net | require | minor | `v0.18.0` -> `v0.19.0` | --- <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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 have created a release *beep* *boop* --- ## [2.5.0](v2.4.0...v2.5.0) (2023-12-12) ### Features * add conversion methods from schema to hcloud objects ([#343](#343)) ([6feda4d](6feda4d)) * add interfaces for client structs ([#342](#342)) ([4f9390f](4f9390f)) * add missing properties ([#349](#349)) ([c8a28d0](c8a28d0)) * **error:** include http response in api errors ([#320](#320)) ([9558239](9558239)) ### Bug Fixes * make schemas consistent with API ([#348](#348)) ([b0d7055](b0d7055)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR adds automatic generation of schema conversion methods in
schema.go
with 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 (convertingschema -> hcloud -> schema
orhcloud -> schema -> hcloud
and testing for equality) and allows for removal of redundant code in hcloud/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.