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

Refactor Swagger EndPoint Validation and Improve Options Handling Mechanism #314

Open
rabdulatif opened this issue Oct 16, 2024 · 1 comment · May be fixed by #315
Open

Refactor Swagger EndPoint Validation and Improve Options Handling Mechanism #314

rabdulatif opened this issue Oct 16, 2024 · 1 comment · May be fixed by #315
Assignees

Comments

@rabdulatif
Copy link
Contributor

The current implementation of the AddSwaggerEndPoints method in BuilderExtensions.cs has some areas that can be improved, particularly in terms of argument validation and options management. Below are the identified areas for improvement:

1.Argument Validation in AddSwaggerEndPoints
The existing argument validation logic is embedded directly in the method, which increases complexity and reduces code clarity. Refactoring this validation process to use an external validation interface would improve readability and maintainability.

2.Limitations of IOptionsMonitor.OnChange
The default IOptionsMonitor.OnChange method only triggers changes based on configuration file (JSON) updates and does not handle options added programmatically at runtime. A custom OnChange handler is needed to address this limitation, allowing the system to respond to both configuration-based options and programmatically added options.

Expected Solution:
Refactor the AddSwaggerEndPoints method to utilize an IEndPointValidator interface for cleaner and more modular validation logic.
Implement a custom OnChange handler to handle changes for both configuration-based options and programmatically added options, ensuring dynamic updates work seamlessly across both scenarios.
This improvement will lead to more maintainable code, greater flexibility, and improved options management within the application

@rabdulatif
Copy link
Contributor Author

rabdulatif commented Oct 16, 2024

Hello @Burgyn
Could you help?
After this i will deploy my project to the server

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