Logging my experience integrating an OpenAPI service, might be useful for others, as there is no documentation as of yet. Module name in example code is "sunfun".
Moduledefinition:
```
<services>
<openapiservice name="appservice" spec="openapi/sunfun.yaml" />
</services>
<backend>
<openapi path="root:/.sunfun/openapi/appservice/" service="appservice" />
</backend>
```
For my .yaml file, I copied the yaml from /webhare_testsuite/tests/system/nodejs/test_generated_files.ts
Endpoint derived from <backend><openapi></backend>, eg:
This page (at the moment) shows some useful URLs to the Swagger UI and spec.
Created a test file "test_openapi.ts" to test basic functionality which basically amounts to:
```
```
Can be run with `wh run mod::sunfun/scripts/test/test_openapi.ts`, just like whscr files.
Problems / takeaways:
1) kept running into `Internal error - enable the 'etr' debug flag to enable full error tracing`, no idea how to set that flag in my test file (a simple ?wh-debug=etr didn't work, would've been nice). Tried from WHLIB using GetSignedWHDebugOptions, also didn't work.
@WebHare any solution for this?
2) If you're getting this error:
```
error: 'Validation of the response (code 200) for "get /activities" returned error: must NOT have additional properties (additionalProperty="description") (at "/0")',
```
Then check your .yaml file, it's probably different from your API response.
3) CORS issues, added the same path as <openapi> in a <webrule> in <backend>:
<openapi path="root:/.sunfun/openapi/appservice/" service="appservice" />
<webrule path="root:/.sunfun/openapi/appservice/" match="initial" >
<addheader header="Access-Control-Allow-Origin" value="*"/>
</webrule>
@WebHare, it works, but is this the proper way? If so, wouldn't it be better to be able to add <addheader> into <openapi>?
4) Added integer as param, needed to use number:
```
parameters:
- name: id
in: path
description: ID of activity to return
required: true
schema:
type: integer
```
=>
...
schema:
type: number
```
All in all, seems to work nicely already!