-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add test for new generator flag
- Loading branch information
root
authored and
root
committed
Sep 23, 2024
1 parent
a6e23cf
commit 01f3179
Showing
11 changed files
with
4,298 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This is a markdown file for my application. | ||
App name is: **Streetlights API V2** | ||
Version running on mode |
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,54 @@ | ||
asyncapi: "2.1.0" | ||
info: | ||
title: Streetlights API V2 | ||
version: "1.0.0" | ||
description: | | ||
The Smartylighting Streetlights API allows you | ||
to remotely manage the city lights. | ||
license: | ||
name: Apache 2.0 | ||
url: "https://www.apache.org/licenses/LICENSE-2.0" | ||
servers: | ||
mosquitto: | ||
url: http://test.mosquitto.org | ||
protocol: http | ||
channels: | ||
user/signedup: | ||
subscribe: | ||
message: | ||
$ref: "#/components/messages/UserSignedUp" | ||
light/measured: | ||
publish: | ||
summary: Inform about environmental lighting conditions for a particular streetlight. | ||
operationId: onLightMeasured | ||
message: | ||
name: LightMeasured | ||
payload: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
minimum: 1 | ||
description: Id of the streetlight. | ||
lumens: | ||
type: integer | ||
minimum: 0 | ||
description: Light intensity measured in lumens. | ||
sentAt: | ||
type: string | ||
format: date-time | ||
description: Date and time when the message was sent. | ||
|
||
components: | ||
messages: | ||
UserSignedUp: | ||
payload: | ||
type: object | ||
properties: | ||
displayName: | ||
type: string | ||
description: Name of the user | ||
email: | ||
type: string | ||
format: email | ||
description: Email of the user |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
'generate:before': generator => { | ||
const asyncapi = generator.originalAsyncAPI; | ||
let extension; | ||
try { | ||
JSON.parse(asyncapi); | ||
extension = 'json' | ||
} catch (error) { | ||
extension = 'yaml' | ||
} | ||
|
||
fs.writeFileSync( | ||
path.resolve( | ||
generator.targetDir, `asyncapi.${extension}` | ||
) | ||
, asyncapi, { encoding: 'utf-8' } | ||
); | ||
} | ||
} |
Oops, something went wrong.