-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Report
When using const strings in the code, the generated XML is incorrect. Instead of correctly including the value of the constant in the XML, it generates empty sting.
Expected Behavior
[Document]
public class ExamplePolicy : IDocument
{
public void Inbound(IInboundContext c)
{
c.SetHeader(Headers.Example, "Test");
}
}
public static class Headers
{
public const string Example = "X-Example";
}
should return
<!-- This file is generated by the Azure API Management Policy Toolkit -->
<!-- Version: 0.0.1.0 -->
<policies>
<inbound>
<set-header name="X-Example" exists-action="override">
<value>Test</value>
</set-header>
</inbound>
</policies>
Actual Behavior
[Document]
public class ExamplePolicy : IDocument
{
public void Inbound(IInboundContext c)
{
c.SetHeader(Headers.Example, "Test");
}
}
public static class Headers
{
public const string Example = "X-Example";
}
returns
<!-- This file is generated by the Azure API Management Policy Toolkit -->
<!-- Version: 0.0.1.0 -->
<policies>
<inbound>
<set-header name="" exists-action="override">
<value>Test</value>
</set-header>
</inbound>
</policies>
Steps to Reproduce the Problem
- Create an example policy with a header as const string.
[Document]
public class ExamplePolicy : IDocument
{
public void Inbound(IInboundContext c)
{
c.SetHeader(Headers.Example, "Test");
}
}
public static class Headers
{
public const string Example = "X-Example";
}
- Run compiler.
Component
Compiler
Version
v1.0.0
Contact Details
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request