Azure / Azure/azure-functions-openapi-extension

Assistance in exposing auto injected swagger endpoints in APIM

Open
#521 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Hi All,

I have recently started using this OpenAPI Extension v1.4.0 in multiple Function Apps that we expose via APIM.

Each function app maps its Http Triggers to a set of operations under their own API in APIM.
eg
* /one/read
* /one/create
* /two/read
* /two/create
* /two/delete
* /three/read

These API's are require subscriptions are covered by policies like CORS and JWT validation, so my first through would be to publish all the generated swagger docments to another location where I can applya different set of policies.

One possibility would be able to expose all the swagger documents in a consolidated fashion and use a single UI instance to render them.
* /swagger/ui
* /swagger/funcapp-one/swagger.{extension}
* /swagger/funcapp-two/swagger.{extension}
* /swagger/funcapp-three/swagger.{extension}

Does this approach make sense?
Or would it be prefereable to expose all 4 injected OpenAPI endpoints individually under each Function App API?

If the consolidated approach is viable, I assume I need to configure the swagger.json of each Function App to expose the correct server information
eg
* funcapp-one
- Server: [APIM_URL]/one
* funcapp-two
- Server: [APIM_URL]/two
* funcapp-three
- Server: [APIM_URL]/three

Then when I enter the standard Swagger UI page, I can add the relevant URL ( eg /swagger/funcapp-one/swagger.json) in the explore toolbar and get to the right API operatoins back.

We use Azure B2C with some implicit flows, and locally it seems to work.
But when I have started prototyping th eabove setup, there seems to be some issues around the injection of the oauth2-redirect.html.

Does this need to be mapped for each FA? is there a way to find out the logic for the redirect URL to make sure it is pointing back to the correct html page?

I know there are lots of questions here. But I have not found any discussions about exposing the injected URL's in APIM, only importing to APIM using the generated swagger.json document.

Basil

Contributor guide

Open the contributing guide

Research direction

Review the injected Swagger endpoints, the swagger.json server values, and the oauth2-redirect.html behavior described for Azure Functions and APIM. Compare the consolidated paths with exposing each endpoint under its Function App, and confirm whether the OAuth redirect can resolve the correct page. Done means the supported routing and redirect approach is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
api, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.