-
Notifications
You must be signed in to change notification settings - Fork 84
Add OpenAPI 3 documentation endpoint for Essentials CWS API #1295
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
base: development
Are you sure you want to change the base?
Conversation
Co-authored-by: andrew-welker <[email protected]>
Co-authored-by: andrew-welker <[email protected]>
|
@copilot you started from the wrong branch. Rebase your branch off of the development branch. |
|
@copilot Can we use attributes from existing swashbuckle nuget packages to add metadata to the handlers and their methods without having to use the 2 if statements in the swagger handler to determine what the paths should be? |
Co-authored-by: andrew-welker <[email protected]>
…system Co-authored-by: andrew-welker <[email protected]>
I've implemented a custom attribute-based system to replace the hardcoded if statements in the SwaggerHandler. Since Swashbuckle.AspNetCore packages aren't compatible with .NET Framework 4.7.2, I created custom OpenAPI attributes that mimic Swashbuckle's approach:
The SwaggerHandler now uses reflection to read these attributes instead of the hardcoded logic. I've updated several request handlers as examples (DevListRequestHandler, DevJsonRequestHandler, etc.) and the system falls back to the original logic for handlers without attributes, ensuring backward compatibility. This makes the code much more maintainable and allows each handler to define its own OpenAPI metadata declaratively. Commit: 213973a Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ve coverage Co-authored-by: andrew-welker <[email protected]>
|
@copilot Looks good. Can you add the new attributes to the rest of the handlers that are defined in this repository? |
Co-authored-by: andrew-welker <[email protected]>
I've added the OpenAPI attributes to all the remaining request handlers defined in this repository. This includes 13 additional handlers covering GET, POST, and mixed endpoint types. All handlers now have comprehensive OpenAPI metadata including operation summaries, descriptions, parameters, request bodies, and response codes. The changes ensure complete API documentation coverage for:
The system successfully builds and the SwaggerHandler can now use reflection to read these attributes for all endpoints. Commit: 95fc8dd Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot This repository uses conventional commit syntax for commit messages. Can you add an empty commit with an appropriate feat message in order to trigger our CI actions? |
Added empty commit with conventional commit message "feat: add OpenAPI 3 documentation endpoint for Essentials CWS API" to trigger CI actions. Commit: 9c56b9b |
|
@copilot add attributes for missing HTTP methods like PUT and DELETE. Use conventional commit syntax. |
…thod support Co-authored-by: andrew-welker <[email protected]>
Added HttpPutAttribute and HttpDeleteAttribute to the OpenAPI attributes system following the same pattern as the existing GET and POST attributes. The SwaggerHandler will automatically detect and process these new HTTP method attributes through reflection. Commit: 1c55003 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements a new
/swaggerendpoint that provides OpenAPI 3.0.3 documentation for the PepperDash Essentials CWS API, enabling integration with tools like ApiDog and automatic client generation for web applications.Changes Made
New SwaggerHandler Implementation
SwaggerHandlerclass following the same pattern asGetRoutesHandlerWebApiBaseRequestHandlerfor consistency with existing architectureRoute Registration
/swaggerroute toEssentialsWebApi.csinitializationGetRoutesHandlerOpenAPI Features Implemented
{deviceKey},{filter})DeviceCommand- for device control operationsDevice- for device informationFeedback- for device status queries (Bool, Int, String feedback types)ApiRoutes- for route discovery$refsyntax for schema reuseAPI Documentation Coverage
The OpenAPI document includes all existing endpoints:
GET Endpoints:
/versions- Version information/devices- Device listing/config- System configuration/deviceFeedbacks/{deviceKey}- Device status/types,/types/{filter}- Type information/joinMap/{bridgeKey},/joinMap/{bridgeKey}/{deviceKey}- Join maps/tielines- Tieline information/device/{deviceKey}/routingPorts- Routing ports/apiPaths- Route discovery/swagger- OpenAPI documentation (new)POST Endpoints:
/deviceCommands/{deviceKey}- Device control/restartProgram- System restart/loadConfig- Configuration loadingUsage
The OpenAPI documentation is available at:
Returns a complete OpenAPI 3.0.3 JSON document that can be:
Example Response Structure
{ "openapi": "3.0.3", "info": { "title": "PepperDash Essentials API", "description": "RESTful API for PepperDash Essentials control system", "version": "1.0.0" }, "servers": [ { "url": "https://192.168.1.100/cws/api", "description": "Essentials API Server" } ], "paths": { "/devices": { "get": { "summary": "DevList", "description": "Retrieve a list of all devices in the system", "responses": { ... } } } }, "components": { "schemas": { ... } } }Fixes #1294.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
crl.entrust.netdotnet build --configuration Release(dns block)ocsp.entrust.netdotnet build --configuration Release(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.