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

fix: rename plans query param categories => categories[] #70

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions equinix_metal/equinix_metal/api/plans_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def find_plans_with_http_info(self, categories : Annotated[Optional[conlist(Stri
# process the query parameters
_query_params = []
if _params.get('categories') is not None: # noqa: E501
_query_params.append(('categories', _params['categories']))
_collection_formats['categories'] = 'multi'
_query_params.append(('categories[]', _params['categories']))
_collection_formats['categories[]'] = 'multi'

if _params.get('type') is not None: # noqa: E501
_query_params.append(('type', _params['type']))
Expand Down
2 changes: 1 addition & 1 deletion metal_openapi.fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12187,7 +12187,7 @@ paths:
parameters:
- description: Filter plans by its category
in: query
name: categories
name: categories[]
schema:
items:
enum:
Expand Down
11 changes: 11 additions & 0 deletions scripts/patch_metal_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ def loadYaml(fn):
del fixedSpec['components']['schemas']['Plan_specs_drives_inner']['properties']['type']['enum']
del fixedSpec['components']['schemas']['Plan_specs_nics_inner']['properties']['type']['enum']

# FIX 13. rename query attribute categories to "categories[]"

plans_get_params = fixedSpec['paths']['/plans']['get']['parameters']

for i, p in enumerate(plans_get_params):
if p['name'] == 'categories':
fixedSpec['paths']['/plans']['get']['parameters'][i]['name'] = "categories[]"
break



# Mark paginated operation with `x-equinix-metal-paginated-property`

refkey = "$ref"
Expand Down