Skip to content
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

feat: add /convert path #26

Merged
merged 24 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ node_modules
public
docs
lib
dist
build
dist
78 changes: 77 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,46 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Problem'

/convert:
post:
summary: Convert the given AsyncAPI document to the specified version.
operationId: convert
tags:
- convert
requestBody:
description: Parameters to convert the spec.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConvertRequest'
responses:
'200':
description: AsyncAPI document successfully converted.
content:
application/zip:
schema:
$ref: '#/components/schemas/ConvertResponse'
'400':
description: Failed to convert due to invalid AsyncAPI document.
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'
'422':
description: Failed to convert the given document due to invalid parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'
default:
description: Unexpected problem.
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'

components:
schemas:
AsyncAPIDocument:
Expand All @@ -104,6 +144,7 @@ components:
- $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.0.0.json
- $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.1.0.json
- $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.2.0.json
- $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.3.0.json
Template:
type: object
required:
Expand Down Expand Up @@ -141,6 +182,41 @@ components:
properties:
asyncapi:
$ref: '#/components/schemas/AsyncAPIDocument'
ConvertRequest:
type: object
required:
- asyncapi
properties:
asyncapi:
$ref: '#/components/schemas/AsyncAPIDocument'
version:
$ref: '#/components/schemas/SpecVersions'
language:
type: string
description: Language to be converted to.
enum:
- 'yaml'
- 'yml'
- 'json'
SpecVersions:
type: string
description: Valid spec versions for the AsyncAPI document.
enum:
- '1.0.0'
- '1.1.0'
- '1.2.0'
- '2.0.0-rc1'
- '2.0.0-rc2'
- '2.0.0'
- '2.1.0'
- '2.2.0'
- '2.3.0'
- 'latest'
ConvertResponse:
type: object
properties:
converted:
$ref: '#/components/schemas/AsyncAPIDocument'
Problem:
type: object
properties:
Expand Down Expand Up @@ -183,4 +259,4 @@ components:
- type
- title
- status
additionalProperties: true
additionalProperties: true
Loading