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

.Net: New Feature: Expose any custom attributes on the underlying function method #8366

Open
anthonypuppo opened this issue Aug 26, 2024 · 3 comments · May be fixed by #8367
Open

.Net: New Feature: Expose any custom attributes on the underlying function method #8366

anthonypuppo opened this issue Aug 26, 2024 · 3 comments · May be fixed by #8367
Assignees
Labels
enhancement .NET Issue or Pull requests regarding .NET code

Comments

@anthonypuppo
Copy link
Contributor

Any custom attributes applied to the method wrapped as a KernelFunction should be available on the Metadata property (e.g., in ASP.NET it's common to use the Authorize attribute for authorization scenarios, the same concept could be applied here and validated in a custom function filter).

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Aug 26, 2024
@github-actions github-actions bot changed the title New Feature: Expose any custom attributes on the underlying function method .Net: New Feature: Expose any custom attributes on the underlying function method Aug 26, 2024
@evchaki
Copy link
Contributor

evchaki commented Aug 26, 2024

@anthonypuppo - good idea. Do you have more scenarios that you are looking into?

@anthonypuppo
Copy link
Contributor Author

@anthonypuppo - good idea. Do you have more scenarios that you are looking into?

The attributes from System.ComponentModel.DataAnnotations (i.e., parameter validation) is another use case that comes to mind. This would involve extracting attributes off the arguments and not just the method itself though.

Lots of different use cases here, especially when combined with filters. You can essentially create your own custom execution pipeline with attributes acting as behavior flags (similar to how the ASP.NET middleware works).

@evchaki
Copy link
Contributor

evchaki commented Aug 26, 2024

@markwallace-microsoft - FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Planned
Development

Successfully merging a pull request may close this issue.

4 participants
@anthonypuppo @evchaki @markwallace-microsoft and others