equinix-labs / metal-go

[Deprecated] Golang client for Equinix Metal
https://deploy.equinix.com/labs/equinix-sdk-go/
MIT License
3 stars 2 forks source link

Fix plan types in spec to match what is returned by the API #154

Closed ctreatma closed 5 months ago

ctreatma commented 1 year ago

The API spec says that the type of a drive in a plan spec must be one of the following:

enum:
- HDD
- SSD
- NVME

However, the API can return the value NVMe, as mentioned in this PR comment from metal-cli: https://github.com/equinix/metal-cli/pull/350#issuecomment-1728298754

The spec needs to be updated so that all possible values for type are documented accurately in the spec.

ctreatma commented 1 year ago

In a pinch we can patch in NVMe as a supported value (leaving NVME in place just in case).

Since drive type is not used to differentiate between different component schemas, this could be a safe place to introduce x-enum-as-string.

The Java generator has a useEnumCaseInsensitive option, which would be another good approach here, but that's not currently supported by the Go generator and I think we'd have to make a generator code change to add it. An x-enum-case-insensitive vendor extension could work here, but I think we'd still need to either make a generator code change to make sure that an enum that is a case-insensitive string imports the "strings" package or add a Make task to fix missing imports (the lint task can't do it because it expects the code being linted to be buildable, and it won't be buildable until the imports are fixed).

ctreatma commented 1 year ago

The enum concerns mentioned here are related to #134 as well.

ctreatma commented 5 months ago

This repo is deprecated and this issue has been copied to equinix/equinix-sdk-go