Skip to content

fix(npm-source): Deprecated field can be bool#2268

Merged
olblak merged 1 commit intomainfrom
unknown repository
Jul 3, 2024
Merged

fix(npm-source): Deprecated field can be bool#2268
olblak merged 1 commit intomainfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jul 2, 2024

updatecli diff returns an error when the deprecated field is a bool.

json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string

I was testing it on a package.json with react and react-dom. The exact output below:

################################
# BUMP "REACT" PACKAGE VERSION #
################################


SOURCES
=======

npm
---
ERROR: error unmarshalling json: "json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string"
ERROR: ✗ json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string
ERROR: ✗ json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string
Pipeline "Bump \"react\" package version" failed
Skipping due to:
        sources stage:  "json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string"


####################################
# BUMP "REACT-DOM" PACKAGE VERSION #
####################################


SOURCES
=======

npm
---
ERROR: error unmarshalling json: "json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string"
ERROR: ✗ json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string
ERROR: ✗ json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string
Pipeline "Bump \"react-dom\" package version" failed
Skipping due to:
        sources stage:  "json: cannot unmarshal bool into Go struct field versions.Versions.Deprecated of type string"

This should make it possible to unmarshal Deprecated fields of type string and bool.

I did not check all occurrences of the struct and the field, maybe it's required to convert to a specific type somwhere, e.g. in pkg/plugins/resources/npm/changelog.go (couldn't find out where it is invoked exactly, because it's my first time using updatecli and I'm quite new to it).

updatecli diff returns an error when the deprecated field is a bool.

json: cannot unmarshal bool into Go struct field
versions.Versions.Deprecated of type string

This should make it possible to unmarshal Deprecated fields of type
string and bool.
Copy link
Copy Markdown
Member

@olblak olblak left a comment

Choose a reason for hiding this comment

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

Thanks for the fix

@olblak olblak added bug Something isn't working resource-npm labels Jul 3, 2024
@olblak olblak enabled auto-merge (squash) July 3, 2024 06:27
@olblak olblak merged commit 5a8f3ec into updatecli:main Jul 3, 2024
@ghost ghost deleted the fix/deprecated-field branch July 3, 2024 06:51
v1v added a commit to v1v/updatecli that referenced this pull request Jul 5, 2024
…ersion' into feature/use-tools-version

* refs/remotes/origin/feature/use-tools-version:
  deps(go): bump module github.com/hashicorp/hcl/v2 (updatecli#2256)
  deps: Bump Golang version to 1.22.5 (updatecli#2267)
  fix(npm-source): Deprecated field can be bool (updatecli#2268)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working resource-npm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant