cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
757 stars 213 forks source link

[ADP-3358] Remove underscores from integer literals in `swagger.yaml`. #4582

Closed jonathanknowles closed 1 month ago

jonathanknowles commented 2 months ago

This PR removes underscores from integer literals in swagger.yaml:

-   maximum: 45_000_000_000_000_000
+   maximum: 45000000000000000

Justification

As part of the release process for cardano-wallet, we transform the API specification (swagger.yaml) to JSON format with the following script:

https://github.com/cardano-foundation/cardano-wallet/blob/6dc7c0389eb2866485fd0e57a33f04f9c9cd1cce/scripts/gh/update-bump.sh#L15

The above script uses the yq tool to perform this transformation.

Recent versions of the yq tool fail with a ParseInt error if there are underscores within integer literals:

$ yq --version
yq (https://github.com/mikefarah/yq/) version v4.40.5
$ yq eval specifications/api/swagger.yaml -o=json
Error: json: error calling MarshalJSON for type *yqlib.CandidateNode:
json: error calling MarshalJSON for type *yqlib.CandidateNode: json:
error calling MarshalJSON for type *yqlib.CandidateNode:
strconv.ParseInt: parsing "45_000_000_000_000_000": invalid syntax

Removing underscores prevents these errors.

Example failure

https://github.com/cardano-foundation/cardano-wallet/actions/runs/9026615038/job/24804201846#step:5:9

Issue

ADP-3358

jonathanknowles commented 1 month ago

Merging by hand, as: