Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending an Operation Parent in Minimal API for Power Apps Webhooks #1699

Open
faramos opened this issue Jun 24, 2024 · 0 comments
Open

Extending an Operation Parent in Minimal API for Power Apps Webhooks #1699

faramos opened this issue Jun 24, 2024 · 0 comments

Comments

@faramos
Copy link

faramos commented Jun 24, 2024

To describe a webhook for Power Apps / Automate, the platform requires an extension in the post operation parent. You can find more details in the documentation.

I have previously implemented this for another product using NSwag and by implementing an IOperationProcessor.

Now, I want to try using OpenAPI.NET, but I'm struggling to extend the generated JSON node for the minimal API group where the operation is added. I have tried implementing IDocumentFilter and using the WithOpenApi() extension method, but both approaches add the extension at the operation level.

Here’s what I have so far:

var casesGroup = group.MapGroup("/when-case-event");
casesGroup.WithOpenApi(o =>
{
    var eventType = typeof(CaseEventWebhookPayload);
    o.Extensions["x-ms-notification-content"] = new OpenApiObject
    {
        { "description", new OpenApiString($"Subscribe to {eventType.Name} event.") },
        {
            "schema", new OpenApiObject
            {
                { "$ref", new OpenApiString($"#/definitions/{eventType.Name}") }
            }
        }
    };
    return o;
});

Is it possible to achieve this in OpenAPI.NET?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant