-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor the code to use
convertOpenAPI
- Loading branch information
Showing
7 changed files
with
93 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
import { convert } from '../src/convert'; | ||
import { convertOpenAPI } from '../src/convert'; | ||
import { assertResults } from './helpers'; | ||
|
||
describe("convert() - openapi to asyncapi", () => { | ||
it("should convert the basic structure of openapi to asyncapi", () => { | ||
const input = fs.readFileSync(path.resolve(__dirname, "input", "openapi", "no-channel-parameter.yml"), "utf8"); | ||
const input = fs.readFileSync(path.resolve(__dirname, "input", "openapi", "no-channel-operation.yml"), "utf8"); | ||
const output = fs.readFileSync(path.resolve(__dirname, "output", "openapi-to-asyncapi", "no-channel-parameter.yml"), "utf8"); | ||
const result = convert(input, '3.0.0'); | ||
const result = convertOpenAPI(input); | ||
assertResults(output, result); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
asyncapi: 3.0.0 | ||
info: | ||
title: Sample Pet Store App | ||
version: 1.0.1 | ||
description: This is a sample server for a pet store. | ||
termsOfService: 'http://example.com/terms/' | ||
contact: | ||
name: API Support | ||
url: 'http://www.example.com/support' | ||
email: support@example.com | ||
license: | ||
name: Apache 2.0 | ||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html' | ||
tags: | ||
name: pet | ||
description: Pets operations | ||
externalDocs: | ||
description: Find more info here | ||
url: 'https://example.com' | ||
|
||
servers: | ||
- url: 'https://{username}.gigantic-server.com:{port}/{basePath}' | ||
description: The production API server | ||
variables: | ||
username: | ||
default: demo | ||
description: >- | ||
this value is assigned by the service provider, in this example | ||
`gigantic-server.com` | ||
port: | ||
enum: | ||
- '8443' | ||
- '443' | ||
default: '8443' | ||
basePath: | ||
default: v2 | ||
|
||
security: | ||
- {} | ||
- petstore_auth: | ||
- 'write:pets' | ||
- 'read:pets' |
This file was deleted.
Oops, something went wrong.