Skip to content
Snippets Groups Projects
Commit c01e452b authored by Neda Moeini's avatar Neda Moeini
Browse files

Fix pydantic error in defining NoneType read-only fields.

parent c421c534
No related branches found
No related tags found
1 merge request!307Feature/l2circuits
......@@ -55,16 +55,14 @@ def initial_input_generator(product_name: str) -> FormGenerator:
vlan_range_label: Label = Field("Please set a VLAN range, bounds including.", exclude=True)
vlan_range_lower_bound: VLAN_ID
vlan_range_upper_bound: VLAN_ID
else:
vlan_range_lower_bound: ReadOnlyField(int) = None
vlan_range_upper_bound: ReadOnlyField(int) = None
vlan_range_lower_bound: ReadOnlyField(None, default_type=int)
vlan_range_upper_bound: ReadOnlyField(None, default_type=int)
vlan_divider: Divider = Field(None, exclude=True)
if initial_user_input.policer_enabled:
policer_bandwidth: BandwidthString
else:
policer_bandwidth: ReadOnlyField(str) = None
policer_bandwidth: ReadOnlyField(None, default_type=str)
policer_divider: Divider = Field(None, exclude=True)
......@@ -87,15 +85,15 @@ def create_subscription(product: UUIDstr, partner: str) -> State:
@step("Initialize subscription")
def initialize_subscription(
subscription: Layer2CircuitInactive,
layer_2_circuit_side_a: dict[str, Any],
layer_2_circuit_side_b: dict[str, Any],
virtual_circuit_id: VC_ID | None,
layer_2_circuit_type: Layer2CircuitType,
vlan_range_lower_bound: VLAN_ID | None,
vlan_range_upper_bound: VLAN_ID | None,
policer_enabled: bool, # noqa: FBT001
policer_bandwidth: BandwidthString | None,
subscription: Layer2CircuitInactive,
layer_2_circuit_side_a: dict[str, Any],
layer_2_circuit_side_b: dict[str, Any],
virtual_circuit_id: VC_ID | None,
layer_2_circuit_type: Layer2CircuitType,
vlan_range_lower_bound: VLAN_ID | None,
vlan_range_upper_bound: VLAN_ID | None,
policer_enabled: bool, # noqa: FBT001
policer_bandwidth: BandwidthString | None,
) -> State:
"""Build a subscription object from all user input."""
subscription.layer_2_circuit.layer_2_circuit_sides = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment