Skip to content

Commit

Permalink
fix: choices_count is integer not string
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Nov 15, 2024
1 parent 43258e5 commit 00ac46b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108173,7 +108173,7 @@ components:
type: boolean
description: Choices are automatically ordered alphabetically
choices_count:
type: string
type: integer
readOnly: true
created:
type: string
Expand Down
10 changes: 5 additions & 5 deletions docs/CustomFieldChoiceSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Name | Type | Description | Notes
**BaseChoices** | Pointer to [**CustomFieldChoiceSetBaseChoices**](CustomFieldChoiceSetBaseChoices.md) | | [optional]
**ExtraChoices** | **[][]interface{}** | |
**OrderAlphabetically** | Pointer to **bool** | Choices are automatically ordered alphabetically | [optional]
**ChoicesCount** | **string** | | [readonly]
**ChoicesCount** | **int32** | | [readonly]
**Created** | **NullableTime** | | [readonly]
**LastUpdated** | **NullableTime** | | [readonly]

## Methods

### NewCustomFieldChoiceSet

`func NewCustomFieldChoiceSet(id int32, url string, display string, name string, extraChoices [][]interface{}, choicesCount string, created NullableTime, lastUpdated NullableTime, ) *CustomFieldChoiceSet`
`func NewCustomFieldChoiceSet(id int32, url string, display string, name string, extraChoices [][]interface{}, choicesCount int32, created NullableTime, lastUpdated NullableTime, ) *CustomFieldChoiceSet`

NewCustomFieldChoiceSet instantiates a new CustomFieldChoiceSet object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -212,20 +212,20 @@ HasOrderAlphabetically returns a boolean if a field has been set.

### GetChoicesCount

`func (o *CustomFieldChoiceSet) GetChoicesCount() string`
`func (o *CustomFieldChoiceSet) GetChoicesCount() int32`

GetChoicesCount returns the ChoicesCount field if non-nil, zero value otherwise.

### GetChoicesCountOk

`func (o *CustomFieldChoiceSet) GetChoicesCountOk() (*string, bool)`
`func (o *CustomFieldChoiceSet) GetChoicesCountOk() (*int32, bool)`

GetChoicesCountOk returns a tuple with the ChoicesCount field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetChoicesCount

`func (o *CustomFieldChoiceSet) SetChoicesCount(v string)`
`func (o *CustomFieldChoiceSet) SetChoicesCount(v int32)`

SetChoicesCount sets ChoicesCount field to given value.

Expand Down
12 changes: 6 additions & 6 deletions model_custom_field_choice_set.go

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

16 changes: 14 additions & 2 deletions scripts/fix-spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Traverse schemas
if 'components' in data and 'schemas' in data['components']:
for name, schema in data['components']['schemas'].items():
for component_name, schema in data['components']['schemas'].items():
if 'properties' in schema:
# Remove "null" item from nullable enums
for name, prop in schema['properties'].items():
Expand Down Expand Up @@ -39,7 +39,19 @@
for ntype in non_nullable_types:
if ntype in schema['properties']:
if schema['properties'][ntype]['format'] == 'binary':
schema['properties'][ntype].pop('nullable')
if 'nullable' in schema['properties'][ntype]:
schema['properties'][ntype].pop('nullable')

change_type = {
"CustomFieldChoiceSet": {
"choices_count": "integer"
}
}

if component_name in change_type.keys():
for propertie in change_type[component_name].keys():
schema['properties'][propertie]['type'] = change_type[component_name][propertie]


# Save the spec file
with open(SPEC_PATH, 'w') as file:
Expand Down

0 comments on commit 00ac46b

Please sign in to comment.