Apieelint throwing FR001 error despite condition being added in FaultRules

While creating a proxy via Azure CICD Pipelines usine apigeetool, the "agipeetool deploy" command is creating a new revision, but the tool is adding unnecessary XML elements. The code I've created is

<FaultRules>
<FaultRule name="faulthandler">
<Step>
<Name>FC-FaultHandler</Name>
<Condition>fault.name != "ErrorResponseCode"</Condition>
</Step>
</FaultRule>

and the code generated by tool in the edge is having a mixed up order as follows -

  <FaultRules>
        <FaultRule name="faulthandler">
            <Step>
                <Condition>fault.name != "ErrorResponseCode"</Condition>
                <FaultRules/>
                <Name>FC-FaultHandler</Name>
            </Step>
        </FaultRule>
    </FaultRules>

Though the issue of adding extra elements already exists, it wasn't really breaking the flow or execution... but the problem started after adding a fault rule, where another <FaultRules/> element is being added inside the FaultRule.

This is causing an issue with apigeelint where it is throwing the "FR001 FaultRule has no Condition or the Condition is empty" error.
I have, as of now given a temporary fix by excluding the FR001 in the apigeelint command and executing it.

Could you please let me know if there's any other better approach where i don't have to exclude the validation of certain steps like I am doing right now?

Solved Solved
0 4 256
1 ACCEPTED SOLUTION

Hi @Nikhila Vuyyuru,

Apigeelint is doing the right thing, it's detecting a FaultRule without a condition, which means that FaultRule will always execute. That's not an issue in your case since you only have one, but its not good if you have more, and its easy to overlook visually.

I've run into this myself as I use a single JavaScript to handle all faults. You can add a Condition in your FaultRule like this, note the location of the Condition

<FaultRules>
    <FaultRule name="ProxyFaultRules">
        <!-- Quiet apigeelint -->
        <Condition>(fault.name != null)</Condition>
        <Step>
            <FaultRules/>
            <Name>JS-proxy-fault-rules</Name>
        </Step>
    </FaultRule>
</FaultRules>

Hope that helps to take the blame off Apigeelint.

View solution in original post

4 REPLIES 4

It seems like a bug in the apigeelint tool.

I suggest that you file a bug on the github repo.

Hi @Nikhila Vuyyuru,

Apigeelint is doing the right thing, it's detecting a FaultRule without a condition, which means that FaultRule will always execute. That's not an issue in your case since you only have one, but its not good if you have more, and its easy to overlook visually.

I've run into this myself as I use a single JavaScript to handle all faults. You can add a Condition in your FaultRule like this, note the location of the Condition

<FaultRules>
    <FaultRule name="ProxyFaultRules">
        <!-- Quiet apigeelint -->
        <Condition>(fault.name != null)</Condition>
        <Step>
            <FaultRules/>
            <Name>JS-proxy-fault-rules</Name>
        </Step>
    </FaultRule>
</FaultRules>

Hope that helps to take the blame off Apigeelint.

Oh, I see. The Condition is inside the Step, rather than applied to the FaultRule itself.
Thanks Kurt!

Hi @Kurt Googler Kanaskie

Thank you for this. It works as expected! 🙂