-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ripple/code-generator
Modifications in async_api to make it valid definition
- Loading branch information
Showing
4 changed files
with
171 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,17 @@ | |
# Submit request (As it will have transaction types as a requirement) | ||
|
||
asyncapi: '2.6.0' | ||
defaultContentType: application/json | ||
id: urn:xrp-ledger:public-api | ||
tags: | ||
- name: xrp-ledger | ||
description: API related to XRP Ledger | ||
info: | ||
title: XRP Ledger Public API | ||
contact: | ||
name: Ripple Dev Support | ||
url: https://ripple.com/contact | ||
email: [email protected] | ||
description: A WebSocket API used to query rippled. | ||
license: | ||
name: MIT License | ||
|
@@ -36,25 +45,31 @@ channels: | |
# a channel where the api is 'subscribed'. This is changed in 3.0.0. | ||
description: The root channel for sending requests and receiving responses. | ||
subscribe: | ||
operationId: subscribeToRoot | ||
message: | ||
oneOf: | ||
- name: AccountChannelsRequest | ||
messageId: AccountChannelsRequest | ||
contentType: application/json | ||
payload: | ||
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsRequest' | ||
- name: AccountInfoRequest | ||
messageId: AccountInfoRequest | ||
contentType: application/json | ||
payload: | ||
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoRequest' | ||
# TODO: Add additional request types for individual requests here | ||
publish: | ||
operationId: publishToRoot | ||
message: | ||
oneOf: | ||
- name: AccountChannelsResponse | ||
messageId: AccountChannelsResponse | ||
contentType: application/json | ||
payload: | ||
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsResponse' | ||
- name: AccountInfoResponse | ||
messageId: AccountInfoResponse | ||
contentType: application/json | ||
payload: | ||
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoResponseV1' | ||
|
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,21 @@ | ||
const $RefParser = require('json-schema-ref-parser') | ||
const fs = require('fs') | ||
|
||
if (!fs.existsSync('./dist')){ | ||
fs.mkdirSync('./dist'); | ||
} | ||
|
||
$RefParser | ||
.dereference('./async_api/websocket_api.yaml') | ||
.then((schema) => { | ||
fs.writeFileSync('dist/async_api.json', JSON.stringify(schema, null, 2)) | ||
}) | ||
.then(() => $RefParser.dereference('./open_api/json_api.yaml')) | ||
.then((schema) => { | ||
fs.writeFileSync('dist/open_api.json', JSON.stringify(schema, null, 2)) | ||
}) | ||
.catch((err) => { | ||
console.error(err) | ||
}).finally(() => { | ||
console.log("Generation process completed"); | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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