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

Normalize field names in JSON outputs #1705

Closed
Grraahaam opened this issue Jan 27, 2021 · 0 comments · Fixed by #1750
Closed

Normalize field names in JSON outputs #1705

Grraahaam opened this issue Jan 27, 2021 · 0 comments · Fixed by #1750
Labels

Comments

@Grraahaam
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Command attempted

I'm using the Scaleway CLI, and I'm wondering why fields name are named and cased differently for a same type (e.g. image, only one tested yet), for example in :

$ scw instance image list -o json
# Structure and fields differs from the following
$ scw instance image get <ID> -o json

Is it made on purpose? Maybe something in the back-end I'm not aware of or for backward compatibility? 🔀

Because when developing solutions based on your tool, it would be easier if every field of a same type (and even all types, when fields are common) are named and case identically.

Expected Behaviour

This is just a proposal, just to get an idea of the actual issue. I'm using snake_case 🐍 , but you can implement whatever suits you best, we'll adapt. Because today, it seems to be a mix between CamelCase 🐫 and snake_case 🐍 , and it's not very convenient

{
   "id": "yyyyyyy",
    "name": "yyyyyyy",
    "arch": "x86_64",
    "creation_date": "yyyyyyy",
    "modification_date": "yyyyyyy",
    "default_bootscript": {
      "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
      "default": true,
      "dtb": "",
      "id": "yyyyyyy",
      "initrd": "yyyyyyy",
      "kernel": "yyyyyyy",
      "organization": "yyyyyyy",
      "project": "yyyyyyy",
      "public": true,
      "title": "x86_64 mainline 4.4.230 rev1",
      "arch": "x86_64",
      "zone": "yyyyyyy"
    },
    "extra_volumes": {},
    "organization_id": "yyyyyyy",
    "project_id": "yyyyyyy",
    "public": false,
    "root_volume": {
      "id": "yyyyyyy",
      "name": "yyyyyyy",
      "size": 80000000000,
      "volume_type": "l_ssd"
    },
    "state": "available",
    "server_id": "yyyyyyy",
    "server_name": "yyyyyyy",
    "zone": "yyyyyyy"
  }
{
    "id": "yyyyyyyyyy",
    "name": "yyyyyyyyyy",
    "arch": "x86_64",
    "creation_date": "yyyyyyyyyy",
    "modification_date": "yyyyyyyyyy",
    "default_bootscript": {
      "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
      "default": true,
      "dtb": "",
      "id": "yyyyyyyyyy",
      "initrd": "yyyyyyyyyy",
      "kernel": "yyyyyyyyyy",
      "organization": "yyyyyyyyyy",
      "project": "yyyyyyyyyy",
      "public": true,
      "title": "x86_64 mainline 4.4.230 rev1",
      "arch": "x86_64",
      "zone": "yyyyyyyyyy"
    },
    "extra_volumes": {},
    "from_server": "yyyyyyyyyy",
    "organization": "yyyyyyyyyy",
    "public": false,
    "root_volume": {
      "id": "yyyyyyyyyy",
      "name": "yyyyyyyyyy",
      "size": 80000000000,
      "volume_type": "l_ssd"
    },
    "state": "available",
    "project": "yyyyyyyyyy",
    "zone": "yyyyyyyyyy"
  }
}

Actual Behaviour

{
   "ID": "yyyyyyy",
    "Name": "yyyyyyy",
    "Arch": "x86_64",
    "CreationDate": "yyyyyyy",
    "ModificationDate": "yyyyyyy",
    "DefaultBootscript": {
      "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
      "default": true,
      "dtb": "",
      "id": "yyyyyyy",
      "initrd": "yyyyyyy",
      "kernel": "yyyyyyy",
      "organization": "yyyyyyy",
      "project": "yyyyyyy",
      "public": true,
      "title": "x86_64 mainline 4.4.230 rev1",
      "arch": "x86_64",
      "zone": "yyyyyyy"
    },
    "ExtraVolumes": {},
    "OrganizationID": "yyyyyyy",
    "ProjectID": "yyyyyyy",
    "Public": false,
    "RootVolume": {
      "id": "yyyyyyy",
      "name": "yyyyyyy",
      "size": 80000000000,
      "volume_type": "l_ssd"
    },
    "State": "available",
    "ServerID": "yyyyyyy",
    "ServerName": "yyyyyyy",
    "Zone": "yyyyyyy"
  }
{
  "image": {
    "id": "yyyyyyyyyy",
    "name": "yyyyyyyyyy",
    "arch": "x86_64",
    "creation_date": "yyyyyyyyyy",
    "modification_date": "yyyyyyyyyy",
    "default_bootscript": {
      "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
      "default": true,
      "dtb": "",
      "id": "yyyyyyyyyy",
      "initrd": "yyyyyyyyyy",
      "kernel": "yyyyyyyyyy",
      "organization": "yyyyyyyyyy",
      "project": "yyyyyyyyyy",
      "public": true,
      "title": "x86_64 mainline 4.4.230 rev1",
      "arch": "x86_64",
      "zone": "yyyyyyyyyy"
    },
    "extra_volumes": {},
    "from_server": "yyyyyyyyyy",
    "organization": "yyyyyyyyyy",
    "public": false,
    "root_volume": {
      "id": "yyyyyyyyyy",
      "name": "yyyyyyyyyy",
      "size": 80000000000,
      "volume_type": "l_ssd"
    },
    "state": "available",
    "project": "yyyyyyyyyy",
    "zone": "yyyyyyyyyy"
  }
}

More info

💻 Using scw CLI v2.2.3 and same behaviour on v2.2.4

Already discussed briefly on Slack, and here I am (thread)

Anyway, it's a great tool. Cheers! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant