Skip to content

Commit

Permalink
[ADP-3358] Remove underscores from integer literals in swagger.yaml. (
Browse files Browse the repository at this point in the history
#4582)

This PR removes underscores from integer literals in `swagger.yaml`:
```patch
-   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
  • Loading branch information
jonathanknowles authored May 10, 2024
2 parents 6dc7c03 + 774d746 commit 6f1b366
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4111,7 +4111,7 @@ x-parametersIntendedStakeAmount: &parametersIntendedStakeAmount
schema:
type: integer
minimum: 0
maximum: 45_000_000_000_000_000 # 45 B ada (in Lovelace)
maximum: 45000000000000000 # 45 B ada (in Lovelace)
description: |
The stake the user intends to delegate in Lovelace. Required.
Expand Down

0 comments on commit 6f1b366

Please sign in to comment.