apache / apache/openwhisk-wskdeploy
Support for Swagger 3.x
- Dominant language
- Go
- Stars
- 75
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
# Subject of the issue
Does wskdeploy support using Swagger 3.x file?
Is OpenWhisk compatible with this OAS?
Your environment
Local computer where trying to deploy:
OpenWhisk CLI 1.0.0
wskdeploy 1.0.0
go version go1.14.7 linux/amd64
Host:
Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1032-aws x86_64)
Kubernetes Version 1.18.6
Helm version v3.2.4
Steps to reproduce
I'm using the following OAS:
open_api3_spec.yaml
```
openapi: '3.0.0'
info:
version: '1.0'
title: Hello World API
servers:
- url: 'https:///api'
description: Development server
paths:
/hello/world:
get:
summary: Returns greeting
description: Returns a greeting to the user!
parameters:
- in: query
name: name
description: The name of the user
schema:
type: string
- in: query
name: place
description: The place where the user is at
schema:
type: string
responses:
'200':
description: Returns the greeting.
content:
application/json:
schema:
$ref: '#/components/schemas/GreetingResponse'
operationId: getHello
x-openwhisk:
namespace: itio
action: hello_world
package: devops
url: 'https:///api/v1/web/itio/devops/hello_world.json'
components:
schemas:
GreetingResponse:
type: object
properties:
greeting:
type: string
description: Greeting response
x-ibm-configuration:
assembly:
execute:
- operation-switch:
title: whisk-invoke
case:
- operations:
- getHello
execute:
- invoke:
target-url: 'https:///api/v1/web/itio/devops/hello_world.json'
verb: keep
otherwise: []
```
manifest.json
```
project:
config: 'open_api3_spec.yaml'
packages:
devops:
version: 1.0
license: Apache-2.0
actions:
hello_world:
function: src/hello.js
annotations:
web-export: true
```
Then executing wskdeploy with these files.
Expected behaviour
API to be created with the OAS.
Actual behaviour
```
Error: manifestreader.go [118]: [ERROR_YAML_FILE_FORMAT_ERROR]: File: [manifest.yaml]:
==> Unable to parse swagger file: {{.err}}
```
Also tried exporting a Swagger 3.0 file from Swagger Hub:
swagger-export.yaml
```
openapi: 3.0.0
info:
title: OpenAPIv3
version: '1.0'
servers:
- url: 'http:///api'
paths:
/users:
get:
summary: Get Users
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
operationId: get-users
components:
schemas:
User:
title: User
type: object
properties:
id:
type: string
name:
type: string
```
Error changed to:
```
error: Unable to parse swagger file: Swagger file is invalid (missing basePath, info, paths, or swagger fields)
```
From the error message, it says missing basePath, but this requirement is obsolete in OpenAPI 3.0.
Contributor guide
Assessment
This issue has not been assessed yet.