-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Proposal to make use of swift-openapi-generator #799
base: develop
Are you sure you want to change the base?
Conversation
-Properly gets data every 30s -Able to send commands -Making use of structured concurrency, ie async/await, actors -Still a lot to do Renamed OpenHABSitemapPage into OpenHABPage to avoid confusion Reworked OpenHABSitemap to properly handle embedded OpenHABPage Created convenience initializers for OpenHAB models to map from openAPI generated models Properly decoding widgets within a widget Manually modifying the OpenHAB's openAPI schema Manually adding X-Atmosphere-Transport in header parameters for pollDataPage Transferred code to package - requires workaround to invoke the CLI manually: https://swiftpackageindex.com/apple/swift-openapi-generator/1.2.1/documentation/swift-openapi-generator/manually-invoking-the-generator-cli : - clone the generator package locally - run locally swift run swift-openapi-generator generate --config ../Sources/OpenHABCore/openapi/openapi-generator-config.yml --output-directory ../GeneratedSources/openapi ../Sources/OpenHABCore/openapi/openapi.json Exclude the package and the generated code from swiftlint Async update for actor APIActor and initialiser with URL about:blank Using APIActor throughout the app Upgrade target to iOS 16 Helper function openHABpollPage(sitemapname: String, longPolling: Bool) for access without Making use internal accesModifier to properly isolate the internals in OpenHABCore Using openAPI generated interface to send command Support for basic authorization Making use of os logger
… create event subscription, Allowing for X-Atmosphere-Transport for long-polling, SitemapWidgetEvent for server side events Experimenting with SSE consumption Include Client and Types to make it compile on github Shifted logging to dedicated ClientMiddleware Created class OpenHABSitemapWidgetEvent Modified openapi to include sitemapName and pageId in SitemapWidgetEvent Getting server sent events working - establishing a subscription and receiving events , not yet consuming / Commented out in OpenHABSitemapViewController
update OpenHABWidget with OpenHABSitemapWidgetEvent Update to swift-tools-version 5.10
In order not to expose decode OpenHABSitemapWidgetEvents manually. Some relaxations required on OpenHABItem
…n switching to swift 6.0
this looks pretty cool, i know absolutely nothing about swift-openapi-generator in swift ;-) |
Would it make sense for me to add an openAPI schema to the myopenhab cloud service? So we can use the generator for calls for registering notifications, listing notifications, etc.... ? |
That would be cool. I just noticed that OpenHAB does not have an openAPI for notifications yet. |
Signed-off-by: Tim Bert <[email protected]>
…nto openapigen
Signed-off-by: Tim Bert <[email protected]>
so i just created a PR for the cloud service, i have not tested this, let me know if this looks about right. I can always deploy this for us to test since it should not hurt anything. Regarding Core, thats going to be a little more difficult, so i would plan to work around it if you can, i think it may take more time then we would want to wait for. |
This is a proposal to make use of swift-openapi-generator presented at WWDC 23.
This proof-of-concept is working on openHAB iOS app:
-Properly polls data and handles updates
-Able to send commands
-Making use of structured concurrency, ie async/await, actors -Still a lot to do
Renamed OpenHABSitemapPage into OpenHABPage to avoid confusion Reworked OpenHABSitemap to properly handle embedded OpenHABPage
Created convenience initializers for OpenHAB models to map from openAPI generated models
Properly decoding required some manual changes on openAPI schema. They are reported as bugs to openHABcore #openhab/openhab-core#4340:
Widgets within a widget
Manually adding X-Atmosphere-Transport in header parameters for pollDataPage
Making use of openAPI in a package requires workaround to invoke the CLI manually: https://swiftpackageindex.com/apple/swift-openapi-generator/1.2.1/documentation/swift-openapi-generator/manually-invoking-the-generator-cli :
cd swift-openapi-generator generate && swift run swift-openapi-generator generate --config ../Sources/OpenHABCore/openapi/openapi-generator-config.yml --output-directory ../Sources/OpenHABCore/GeneratedSources/openapi ../Sources/OpenHABCore/openapi/openapi.json
Exclude the package and the generated code from swiftlint
Upgrade target to iOS 16
Making use of os logger new API
Support for basic authorization