mongodb / openapi

MongoDB OpenAPI specs
Apache License 2.0
5 stars 7 forks source link

fix: update `changelog metadata create` command to save the correct struct #194

Closed andreaangiolillo closed 2 months ago

andreaangiolillo commented 2 months ago

Proposed changes

This PR fixes a bug with the changelog metadata create command where the command was saving bytes into the output file when the -o flag was used.

I tested my changes locally.

Bug

 ./bin/foascli changelog metadata create --sha e624d716e86f6910757b60cefdf3aa3181582d38 --versions=2024-01-01,2024-09-22 --output metadata.json
2024/08/22 12:06:24
File was saved in 'metadata.json'.

 cat metadata.json  
"ewogICJydW5EYXRlIjogIjIwMjQtMDgtMjIiLAogICJzcGVjUmV2aXNpb24iOiAiZTYyNGQ3MTZlODZmNjkxMDc1N2I2MGNlZmRmM2FhMzE4MTU4MmQzOCIsCiAgInNwZWNSZXZpc2lvblNob3J0IjogImU2MjRkNzE2ZTg2IiwKICAidmVyc2lvbnMiOiBbCiAgICAiMjAyNC0wMS0wMSIsCiAgICAiMjAyNC0wOS0yMiIKICBdCn0="

With PR changes:

 ./bin/foascli changelog metadata create --sha e624d716e86f6910757b60cefdf3aa3181582d38 --versions=2024-01-01,2024-09-22 --output metadata.json
2024/08/22 12:06:24
File was saved in 'metadata.json'.

 cat metadata.json                                                                                                                         
{
  "runDate": "2024-08-22",
  "specRevision": "e624d716e86f6910757b60cefdf3aa3181582d38",
  "specRevisionShort": "e624d716e86",
  "versions": [
    "2024-01-01",
    "2024-09-22"
  ]
}