Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

fix: remove plan drive type and nic type enums #156

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

ctreatma
Copy link
Contributor

The previous fix for plan drive type did not work; it turns out that the API plan data includes plans with drive type NVMe and plans with drive type NVME. As mentioned on the previous PR, adding both options to the enum generates invalid code, and we don't have a practical way to enable case-insensitive comparisons for string enums.

Reverting the plan drive type to a plain string uncovered a different issue with the nic type enum: some plans (storage type, possibly others) include the following for drives and nics:

                "drives": [
                    {
                        "count": 0,
                        "size": "",
                        "type": ""
                    }
                ],
                "nics": [
                    {
                        "count": 0,
                        "type": ""
                    }
                ]

Rather than test nullable: true here, I opted to change the nic type to a plain string as well.

@ctreatma
Copy link
Contributor Author

In terms of data quality, I think the values we're seeing for drive type and nic type indicate that 2 long-term fixes are needed:

  1. The fact that both NVMe and NVME exist as drive types indicates a lack of input validation and/or data normalization in the API; if the spec says NVME then NVMe should be rejected as an input, or at least the API should convert the drive type to uppercase in response JSON
  2. For plans that have no drives or no nics, it would be better to return an empty array (drives: []) or omit the field entirely

@displague
Copy link
Member

Bye, enums 😢 (I wonder if Redoc x- extensions offer a way to list the likely values)

@ctreatma ctreatma merged commit 44b4c1a into main Sep 21, 2023
3 checks passed
@ctreatma ctreatma deleted the remove-plan-drive-type-enum branch September 21, 2023 18:16
@github-actions
Copy link
Contributor

This PR is included in version 0.22.2 🎉

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

Successfully merging this pull request may close these issues.

2 participants