apigeetool deployproxy empty elements added in code

Not applicable

Hi,

when I'm using apigeetool deployproxy command

apigeetool deployproxy -u <username> -p <password> -o <organisation> -e <environment> -n <api-name> -d .

which pushes the content of the current directory as a new revision of API proxy and deploys this proxy to dev environment, unecessary XML elements are added to code.

For example, my code before uploading it to the apigee looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation name="MV.JSONValidation">
    <DisplayName>MV.JSONValidation</DisplayName>
    <Source>request</Source>
</MessageValidation>

But after deployment what I see in Edge UI is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true" name="MV.JSONValidation">
    <DisplayName>MV.JSONValidation</DisplayName>
    <FaultRules/>
    <Properties/>
    <Source>request</Source>
</MessageValidation>

As you can see MessageValidation policy got new (according to documentation - obsolete or optional) attributes with default values. Also - two unecessary, empty elements were added: <Properties/> and <FaultRules/>.

Is this behaviour expected? If so - what is the reason for this? Isn't it that adding unnecessary code for example reduces its readability?

0 3 113
3 REPLIES 3

I haven't seen the source code of apigeetool but i do not see this as a problem.

It is completely possible that the tool is generating this based off XML templates or constructing pre-determined templates which allows for empty fault rules and properties elements.

One of the problems might be the difference between codebase version and deployed version. When right after deployment I will download the newest revision and compare it to the repository branch that I have just deployed, every new file will be marked as modified, even though this branch is right after deployment (so the code should match 1:1). It seems to be pretty cumbersome, since we need to merge these "apigetool changes" back to the repository so that code is the same in both places.

You should not try to merge apigeetool changes back. Your script/job using apigeetool should work off the code cloned from a source code repository. I hope you see it's the other way around

For a proxy bundle, you will generally find it hard to get a 1:1 match between the deployed code and checked in source code.

For e.g. If you are in the business of using environment specific variables in your proxy, those variables are substituted inside your policies per environment during the deployment process . The checked in code just has placeholders. So, your source code repository will never contain the code deployed in your production. However, your production deployment must always be reproducible and derivable from the code checked into the repository.