diff --git a/api/openapi.yaml b/api/openapi.yaml index 0270d9db3a..c7bb24cd84 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -98504,6 +98504,7 @@ components: allOf: - $ref: '#/components/schemas/NestedIPAddress' readOnly: true + nullable: true primary_ip4: allOf: - $ref: '#/components/schemas/NestedIPAddress' @@ -99406,6 +99407,7 @@ components: allOf: - $ref: '#/components/schemas/NestedIPAddress' readOnly: true + nullable: true primary_ip4: allOf: - $ref: '#/components/schemas/NestedIPAddress' @@ -131389,6 +131391,7 @@ components: allOf: - $ref: '#/components/schemas/NestedIPAddress' readOnly: true + nullable: true primary_ip4: allOf: - $ref: '#/components/schemas/NestedIPAddress' diff --git a/scripts/fix-spec.py b/scripts/fix-spec.py index e3e3f403b9..926763bdb8 100755 --- a/scripts/fix-spec.py +++ b/scripts/fix-spec.py @@ -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: