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

Commit

Permalink
fix: update spec for plan drive type to match API response (#155)
Browse files Browse the repository at this point in the history
Relates to #154 (technically a fix, but I want to leave that issue open
in hopes of a better solution later)

This updates the enum items for drive types in a plan spec to change
`NVME` to `NVMe`. The original spec has `NVME`, but the API actually
uses the value `NVMe`, and the difference in case causes API responses
to be invalid according to the spec.

I tried patching in `NVMe` as an additional option, as mentioned in
#154 (comment),
but that causes the generator to generate invalid code because the
constants for `NVMe` and `NVME` are both generated with the same name:

```
metal/v1/model_plan_specs_drives_inner_type.go:27:2: PLANSPECSDRIVESINNERTYPE_NVME redeclared in this block
```

We could patch the spec to remove the enum entirely for this property,
but I wanted to keep this change as small as possible.
  • Loading branch information
ctreatma authored Sep 20, 2023
1 parent b038c05 commit d8f34d7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30738,7 +30738,7 @@ components:
enum:
- HDD
- SSD
- NVME
- NVMe
type: string
Plan_specs_drives_inner_category:
enum:
Expand Down
2 changes: 1 addition & 1 deletion docs/PlanSpecsDrivesInnerType.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

* `SSD` (value: `"SSD"`)

* `NVME` (value: `"NVME"`)
* `NVME` (value: `"NVMe"`)


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
4 changes: 2 additions & 2 deletions metal/v1/model_plan_specs_drives_inner_type.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions patches/spec.fetched.json/20230920-plan-drive-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/spec/oas3.patched/components/schemas/Plan.yaml b/spec/oas3.patched/components/schemas/Plan.yaml
index 0b5f1d5..c8cdf6f 100644
--- a/spec/oas3.patched/components/schemas/Plan.yaml
+++ b/spec/oas3.patched/components/schemas/Plan.yaml
@@ -97,7 +97,7 @@ properties:
enum:
- HDD
- SSD
- - NVME
+ - NVMe
size:
type: string
example: 3.84TB
2 changes: 1 addition & 1 deletion spec/oas3.patched/components/schemas/Plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ properties:
enum:
- HDD
- SSD
- NVME
- NVMe
size:
type: string
example: 3.84TB
Expand Down

0 comments on commit d8f34d7

Please sign in to comment.