Skip to content
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: use custom IDOrName type for schemas #545

Merged
merged 2 commits into from
Nov 5, 2024
Merged

feat: use custom IDOrName type for schemas #545

merged 2 commits into from
Nov 5, 2024

Conversation

jooola
Copy link
Member

@jooola jooola commented Nov 4, 2024

Add typing information to the fields that support passing either an ID as int, an ID as string or a Name as string. An empty value will be marshalled to null to reflect the behavior of an empty interface.

After this change, we do not have to cast IDs to float64 or to string to be able to read the values.

Since this is part of the schema package, this is not a breaking change for our customers, but might break our tests that rely on casting the interface to the desired type.

@jooola jooola requested a review from a team as a code owner November 4, 2024 14:16
@jooola jooola requested a review from apricote November 4, 2024 14:16
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.08%. Comparing base (9903f4d) to head (4b6096f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hcloud/schema/id_or_name.go 92.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #545      +/-   ##
==========================================
+ Coverage   67.71%   68.08%   +0.36%     
==========================================
  Files          46       47       +1     
  Lines        4882     4900      +18     
==========================================
+ Hits         3306     3336      +30     
+ Misses       1166     1158       -8     
+ Partials      410      406       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jooola jooola changed the title refactor: use custom IDOrName type for schemas feat: use custom IDOrName type for schemas Nov 4, 2024
Copy link
Member

@apricote apricote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@jooola jooola merged commit 1d97017 into main Nov 5, 2024
5 checks passed
@jooola jooola deleted the id_or_name branch November 5, 2024 11:10
jooola pushed a commit that referenced this pull request Nov 5, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.16.0](v2.15.0...v2.16.0)
(2024-11-05)


### Features

* use custom IDOrName type for schemas
([#545](#545))
([1d97017](1d97017))


### Bug Fixes

* **metadata:** trim responses before parsing
([#547](#547))
([283363f](283363f)),
closes [#540](#540)

---
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>
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this pull request Nov 5, 2024
…6.0 (hetznercloud/fleeting-plugin-hetzner!158)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | require | minor | `v2.15.0` -> `v2.16.0` |

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go/v2)</summary>

### [`v2.16.0`](https://github.com/hetznercloud/hcloud-go/releases/tag/v2.16.0)

[Compare Source](hetznercloud/hcloud-go@v2.15.0...v2.16.0)

##### Features

-   use custom IDOrName type for schemas ([#&#8203;545](hetznercloud/hcloud-go#545)) ([1d97017](hetznercloud/hcloud-go@1d97017))

##### Bug Fixes

-   **metadata:** trim responses before parsing ([#&#8203;547](hetznercloud/hcloud-go#547)) ([283363f](hetznercloud/hcloud-go@283363f)), closes [#&#8203;540](hetznercloud/hcloud-go#540)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNyIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants