openhab-ios icon indicating copy to clipboard operation
openhab-ios copied to clipboard

Proposal to make use of swift-openapi-generator

Open timbms opened this issue 6 months ago • 4 comments

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 #https://github.com/openhab/openhab-core/issues/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 :

  • clone the generator package locally
  • run locally 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

timbms avatar Aug 12 '24 20:08 timbms