Skip to content

Commit

Permalink
Fix "primary_ip" nullable type.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0ctor committed Jan 18, 2024
1 parent 97dbb8f commit b34d5dc
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 30 deletions.
3 changes: 3 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98504,6 +98504,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down Expand Up @@ -99406,6 +99407,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down Expand Up @@ -131389,6 +131391,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down
14 changes: 12 additions & 2 deletions docs/Device.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Name | Type | Description | Notes
**ParentDevice** | [**NullableNestedDevice**](NestedDevice.md) | | [readonly]
**Status** | Pointer to [**DeviceStatus**](DeviceStatus.md) | | [optional]
**Airflow** | Pointer to [**DeviceAirflow**](DeviceAirflow.md) | | [optional]
**PrimaryIp** | [**NestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp** | [**NullableNestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp4** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**PrimaryIp6** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**OobIp** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
Expand Down Expand Up @@ -56,7 +56,7 @@ Name | Type | Description | Notes

### NewDevice

`func NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *Device`
`func NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NullableNestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *Device`

NewDevice instantiates a new Device object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -676,6 +676,16 @@ and a boolean to check if the value has been set.
SetPrimaryIp sets PrimaryIp field to given value.


### SetPrimaryIpNil

`func (o *Device) SetPrimaryIpNil(b bool)`

SetPrimaryIpNil sets the value for PrimaryIp to be an explicit nil

### UnsetPrimaryIp
`func (o *Device) UnsetPrimaryIp()`

UnsetPrimaryIp ensures that no value is present for PrimaryIp, not even an explicit nil
### GetPrimaryIp4

`func (o *Device) GetPrimaryIp4() NestedIPAddress`
Expand Down
14 changes: 12 additions & 2 deletions docs/DeviceWithConfigContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Name | Type | Description | Notes
**ParentDevice** | [**NullableNestedDevice**](NestedDevice.md) | | [readonly]
**Status** | Pointer to [**DeviceStatus**](DeviceStatus.md) | | [optional]
**Airflow** | Pointer to [**DeviceAirflow**](DeviceAirflow.md) | | [optional]
**PrimaryIp** | [**NestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp** | [**NullableNestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp4** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**PrimaryIp6** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**OobIp** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
Expand Down Expand Up @@ -57,7 +57,7 @@ Name | Type | Description | Notes

### NewDeviceWithConfigContext

`func NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *DeviceWithConfigContext`
`func NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NullableNestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *DeviceWithConfigContext`

NewDeviceWithConfigContext instantiates a new DeviceWithConfigContext object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -677,6 +677,16 @@ and a boolean to check if the value has been set.
SetPrimaryIp sets PrimaryIp field to given value.


### SetPrimaryIpNil

`func (o *DeviceWithConfigContext) SetPrimaryIpNil(b bool)`

SetPrimaryIpNil sets the value for PrimaryIp to be an explicit nil

### UnsetPrimaryIp
`func (o *DeviceWithConfigContext) UnsetPrimaryIp()`

UnsetPrimaryIp ensures that no value is present for PrimaryIp, not even an explicit nil
### GetPrimaryIp4

`func (o *DeviceWithConfigContext) GetPrimaryIp4() NestedIPAddress`
Expand Down
14 changes: 12 additions & 2 deletions docs/VirtualMachineWithConfigContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Name | Type | Description | Notes
**Role** | Pointer to [**NullableNestedDeviceRole**](NestedDeviceRole.md) | | [optional]
**Tenant** | Pointer to [**NullableNestedTenant**](NestedTenant.md) | | [optional]
**Platform** | Pointer to [**NullableNestedPlatform**](NestedPlatform.md) | | [optional]
**PrimaryIp** | [**NestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp** | [**NullableNestedIPAddress**](NestedIPAddress.md) | | [readonly]
**PrimaryIp4** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**PrimaryIp6** | Pointer to [**NullableNestedIPAddress**](NestedIPAddress.md) | | [optional]
**Vcpus** | Pointer to **NullableFloat64** | | [optional]
Expand All @@ -36,7 +36,7 @@ Name | Type | Description | Notes

### NewVirtualMachineWithConfigContext

`func NewVirtualMachineWithConfigContext(id int32, url string, display string, name string, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, interfaceCount int32, virtualDiskCount int32, ) *VirtualMachineWithConfigContext`
`func NewVirtualMachineWithConfigContext(id int32, url string, display string, name string, primaryIp NullableNestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, interfaceCount int32, virtualDiskCount int32, ) *VirtualMachineWithConfigContext`

NewVirtualMachineWithConfigContext instantiates a new VirtualMachineWithConfigContext object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -386,6 +386,16 @@ and a boolean to check if the value has been set.
SetPrimaryIp sets PrimaryIp field to given value.


### SetPrimaryIpNil

`func (o *VirtualMachineWithConfigContext) SetPrimaryIpNil(b bool)`

SetPrimaryIpNil sets the value for PrimaryIp to be an explicit nil

### UnsetPrimaryIp
`func (o *VirtualMachineWithConfigContext) UnsetPrimaryIp()`

UnsetPrimaryIp ensures that no value is present for PrimaryIp, not even an explicit nil
### GetPrimaryIp4

`func (o *VirtualMachineWithConfigContext) GetPrimaryIp4() NestedIPAddress`
Expand Down
16 changes: 9 additions & 7 deletions model_device.go

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

16 changes: 9 additions & 7 deletions model_device_with_config_context.go

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

16 changes: 9 additions & 7 deletions model_virtual_machine_with_config_context.go

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

12 changes: 9 additions & 3 deletions scripts/fix-spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@
if 'properties' in prop and 'value' in prop['properties'] and 'enum' in prop['properties']['value'] and None in prop['properties']['value']['enum']:
prop['properties']['value']['enum'].remove(None)

# Fix "parent_device" nullable type
if 'parent_device' in schema['properties']:
schema['properties']['parent_device']['nullable'] = True
# Fix nullable types
nullable_types = [
'parent_device',
'primary_ip',
]

for ntype in nullable_types:
if ntype in schema['properties']:
schema['properties'][ntype]['nullable'] = True

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

0 comments on commit b34d5dc

Please sign in to comment.