stephaneey / azure-apim-extension

Full Azure API Management suite and more VSTS extension
MIT License
66 stars 48 forks source link

Bad operationid when updating in VSTS using API Management Suite, but not when doing update using Azure Portal #5

Closed PeterSkov88 closed 6 years ago

PeterSkov88 commented 6 years ago

First of all thank you for a great module.

We have one small but crucial problem, we are unsure if it is our fault, your fault or if it is the API Management REST API.

The problem is that when changing name or adding a new service we get sometime get a operationid that is "5abdd23213u3.." instead of the real name. If you need an example JSON file that generates this please let me know.

We have had this problem before during this spring due to: https://blogs.msdn.microsoft.com/apimanagement/2018/04/11/important-changes-to-openapi-import-and-export/

This is is a versioned API and we are updating it.

Best Wishes Peter

stephaneey commented 6 years ago

Hi,

Yes, could you provide me with a demo .JSON, I can't reproduce your issue.

Thanks

PeterSkov88 commented 6 years ago

Hi! Of course, I will test it again when I am back att the office in the 6:th of August and give you an example or retract my issue.

Best wishes Peter

Den ons 25 juli 2018 14:25stephaneey notifications@github.com skrev:

Hi,

Yes, could you provide me with a demo .JSON, I can't reproduce your issue.

Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stephaneey/azure-apim-extension/issues/5#issuecomment-407736790, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ6tkaFhrx57HNtNwjpCUjyY8OnuNtqOks5uKGPNgaJpZM4UaQtR .

PeterSkov88 commented 6 years ago

Hi! Now that I revisited the problem I realize that it might just happen when using HEADER for versioning an API (we do that for all out APIs). So If you take my examplefile, modified_swagger_that_generates_error.zip (have to unpack it), and manually import it using the azure portal and you need an instance of api management:

bild

so choose the file (unpacked version) and remember to version the api using the Header scheme and set whatever to version identifier and version header (needs to be something, we used v1 and Api-Version

bild

and then press Create.

And if you then export the OpenApi-definiton for the new Testing ProfileImage API from inside API Management in the Azure portal you see that the operationid of the different functions are the function names like "GetAllSmall", etc.

Of course now you need to make a change and make sure your vsts-module do the updating of the api, so we jump into VSTS instead of the Azure Portal for a couple of minutes:

bild

Then I trigger a new release.

The change I made was to rename GetAllSmall => GetAll ("operationId": "GetAll",) and at the same time updated the path: ""/persons/{norEduPersonLin}/profileimages" => "/persons/{norEduPersonLin}/profileimages/all" and that file is located in http://taltest.unit.liu.se/modified_swagger_that_generates_error_with_namechange.json (you should be able to use the same location)

After the release is done I go back to the azure portal again and see that the Testing-ProfileImage service has been updated: bild

GetAllSmall is now called GetAll! So then I export the OpenApi-definition and check the operationids again:

Now for the new function "/persons/{norEduPersonLin}/profileimages/all" I get the operationid that looks something like:

operationId": "5b6471c998792b0b5cb9073f"

But if I instead import it using the Azure Portal, it looks correct:

bild

And press import and then export the OpenApi-defintion again:

Now for the new function "/persons/{norEduPersonLin}/profileimages/all" I get the operationid that is: "operationId": "GetAll",

If you have any followup questuions, let me know, we would really like to get this fixed!

Best Wishes Peter

stephaneey commented 6 years ago

Hi,

Thanks for reporting this. This is indeed a bug as the extension only supports the path-based scheme. I'm going to release a new version with the support of both the header & querystring schemes as well.

PeterSkov88 commented 6 years ago

Thank you!

Tell us when it is done and we will test it as much as we can (with other examples than the one above).

Best Wishes Peter

stephaneey commented 6 years ago

Hi Peter,

I've just released the new version that includes the versioning scheme. It behaves as in the portal so your issue should be fixed now. Note that in theory, changes should be brought automatically to your tenant but I can't tell you when exactly. Microsoft runs background jobs to propagate extensions to bound tenants.

Note that if you copy/paste the Swagger definition from the portal itself, you'll end up with numerical operation identifiers. If my extension receives such a swagger, you will indeed endup with operation ids instead of names but there is nothing I can do to prevent this. I "forward" the swagger I receive to APIM and APIM creates the API accordingly.

Best Regads