rbw / aiosnow

Asynchronous ServiceNow Library
MIT License
73 stars 12 forks source link

Chained conditions are sometimes omitted #86

Closed rbw closed 3 years ago

rbw commented 3 years ago

query = select(
    Incident.number.starts_with("INC123")
    &
    Incident.priority.less_than(5)
    |
    Incident.impact.less_than(3)
    ^
    Incident.priority.greater_than(1)
)

Gets serialized into numberSTARTSWITHINC123^priority<5^ORimpact<3, i.e. the last logical operator (NQ / bitwise XOR) and Condition is omitted. The same behavior is observed when replacing the bitwise XOR with bitwise AND.

The bitwise OR however, works in this scenario:


query = select(
    Incident.number.starts_with("INC123")
    &
    Incident.priority.less_than(5)
    |
    Incident.impact.less_than(3)
    |
    Incident.priority.greater_than(1)
)

Result: numberSTARTSWITHINC123^priority<5^ORimpact<3^ORpriority>1

There is most likely something broken in the chain creation mechanism of Condition.

This needs to be fixed and the query system properly tested.

rbw commented 3 years ago

Fixed #94