From 174a093ce08ec5962776bc34d417aa5cad6fdea2 Mon Sep 17 00:00:00 2001 From: Jack Stevenson Date: Fri, 18 Oct 2024 10:59:10 +1100 Subject: [PATCH] feat(type-safe-api): remove wrapper scripts for websocket docs projects (#861) Remove the wrappers around the asyncapi documentation generators and instead call them directly with `npx`. Remove the wrapper around generating the asyncapi spec and instead add it as a subcommand of the type-safe-api script to make it much faster. --- .projen/tasks.json | 9 -- packages/pdk/package.json | 10 +- packages/type-safe-api/package.json | 10 +- .../type-safe-api/custom/docs/asyncapi-html | 44 --------- .../custom/docs/asyncapi-markdown | 43 -------- .../generate-asyncapi-spec | 40 -------- .../generate-asyncapi-spec.ts | 6 +- .../scripts/type-safe-api/run.ts | 3 + .../src/project/codegen/components/utils.ts | 5 +- ...ted-asyncapi-html-documentation-project.ts | 10 +- ...asyncapi-markdown-documentation-project.ts | 9 +- .../type-safe-websocket-api-model-project.ts | 2 +- ...pe-safe-websocket-api-project.test.ts.snap | 76 +++++++------- ...pi-html-documentation-project.test.ts.snap | 2 +- ...arkdown-documentation-project.test.ts.snap | 2 +- ...e-websocket-api-model-project.test.ts.snap | 8 +- .../generate-asyncapi-spec.test.ts | 2 +- .../__snapshots__/docs.test.ts.snap | 99 ------------------- .../test/scripts/generators/docs.test.ts | 28 ------ projenrc/projects/type-safe-api-project.ts | 9 -- 20 files changed, 60 insertions(+), 357 deletions(-) delete mode 100755 packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-html delete mode 100755 packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-markdown delete mode 100755 packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec diff --git a/.projen/tasks.json b/.projen/tasks.json index 05e8e174a..3121e4e19 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -251,15 +251,6 @@ }, { "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/generators/generate $(pnpm bin)/type-safe-api.generate &>/dev/null; exit 0;" - }, - { - "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-html $(pnpm bin)/type-safe-api.generate-asyncapi-html-docs &>/dev/null; exit 0;" - }, - { - "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-markdown $(pnpm bin)/type-safe-api.generate-asyncapi-markdown-docs &>/dev/null; exit 0;" - }, - { - "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec $(pnpm bin)/type-safe-api.generate-asyncapi-spec &>/dev/null; exit 0;" } ] } diff --git a/packages/pdk/package.json b/packages/pdk/package.json index 9dd444b4c..02995190c 100644 --- a/packages/pdk/package.json +++ b/packages/pdk/package.json @@ -11,10 +11,7 @@ "type-safe-api.clean-openapi-generated-code": "./scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "type-safe-api.copy-async-smithy-transformer": "./scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", "type-safe-api.copy-gradle-wrapper": "./scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper", - "type-safe-api.generate": "./scripts/type-safe-api/generators/generate", - "type-safe-api.generate-asyncapi-html-docs": "./scripts/type-safe-api/custom/docs/asyncapi-html", - "type-safe-api.generate-asyncapi-markdown-docs": "./scripts/type-safe-api/custom/docs/asyncapi-markdown", - "type-safe-api.generate-asyncapi-spec": "./scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec" + "type-safe-api.generate": "./scripts/type-safe-api/generators/generate" }, "scripts": { "build": "pnpm exec projen build", @@ -193,16 +190,13 @@ "./_scripts/pdk.sh", "./_scripts/exec-command.js", "./scripts/type-safe-api/common/common.sh", - "./scripts/type-safe-api/custom/docs/asyncapi-html", - "./scripts/type-safe-api/custom/docs/asyncapi-markdown", "./scripts/type-safe-api/generators/generate", "./scripts/type-safe-api/run.js", "./scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "./scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper", "./scripts/type-safe-api/custom/gradle-wrapper/gradlew", "./scripts/type-safe-api/custom/gradle-wrapper/gradlew.bat", - "./scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", - "./scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec" + "./scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer" ] }, "typesVersions": { diff --git a/packages/type-safe-api/package.json b/packages/type-safe-api/package.json index b6b68a4e6..8c44e2dad 100644 --- a/packages/type-safe-api/package.json +++ b/packages/type-safe-api/package.json @@ -9,10 +9,7 @@ "type-safe-api.clean-openapi-generated-code": "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "type-safe-api.copy-async-smithy-transformer": "scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", "type-safe-api.copy-gradle-wrapper": "scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper", - "type-safe-api.generate": "scripts/type-safe-api/generators/generate", - "type-safe-api.generate-asyncapi-html-docs": "scripts/type-safe-api/custom/docs/asyncapi-html", - "type-safe-api.generate-asyncapi-markdown-docs": "scripts/type-safe-api/custom/docs/asyncapi-markdown", - "type-safe-api.generate-asyncapi-spec": "scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec" + "type-safe-api.generate": "scripts/type-safe-api/generators/generate" }, "scripts": { "build": "pnpm exec projen build", @@ -112,16 +109,13 @@ "access": "public", "executableFiles": [ "scripts/type-safe-api/common/common.sh", - "scripts/type-safe-api/custom/docs/asyncapi-html", - "scripts/type-safe-api/custom/docs/asyncapi-markdown", "scripts/type-safe-api/generators/generate", "scripts/type-safe-api/run.js", "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper", "scripts/type-safe-api/custom/gradle-wrapper/gradlew", "scripts/type-safe-api/custom/gradle-wrapper/gradlew.bat", - "scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", - "scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec" + "scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer" ] }, "version": "0.0.0", diff --git a/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-html b/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-html deleted file mode 100755 index deaf6efb5..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-html +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -set -e - -# Parse arguments -spec_path='' -output_path='' -while [[ "$#" -gt 0 ]]; do case $1 in - --spec-path) spec_path="$2"; shift;; - --output-path) output_path="$2"; shift;; -esac; shift; done - -echo "Generating AsyncAPI HTML documentation..." - -working_dir=$(pwd) -script_dir="$( cd -- "$(dirname $([ -L "${BASH_SOURCE[0]:-$0}" ] && readlink -f "${BASH_SOURCE[0]:-$0}" || echo "${BASH_SOURCE[0]:-$0}"))" >/dev/null 2>&1 ; pwd -P )"; - -# load common package manager helper functions -. "$script_dir/../../common/common.sh" - -# Create a temporary directory -tmp_dir=$(mktemp -d "${TMPDIR:-/tmp/}generate-docs-async-api-html.XXXXXXXXX") -cd $tmp_dir - -log "async-api-html :: tmp_dir :: $tmp_dir" - -# Install dependencies -install_packages - -# Generate -run_command asyncapi generate fromTemplate "$working_dir/$spec_path" @asyncapi/html-template@2.3.2 \ - --param singleFile=true \ - --param outFilename=index.html \ - --force-write - -# Copy html docs to output path -rm -f $working_dir/$output_path/index.html -cp index.html $working_dir/$output_path/index.html - -echo "AsyncAPI HTML documentation generation done!" - -# Clean up -cd $working_dir -rm -rf $tmp_dir diff --git a/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-markdown b/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-markdown deleted file mode 100755 index 7290a6c1f..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/custom/docs/asyncapi-markdown +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -e - -# Parse arguments -spec_path='' -output_path='' -while [[ "$#" -gt 0 ]]; do case $1 in - --spec-path) spec_path="$2"; shift;; - --output-path) output_path="$2"; shift;; -esac; shift; done - -echo "Generating AsyncAPI Markdown documentation..." - -working_dir=$(pwd) -script_dir="$( cd -- "$(dirname $([ -L "${BASH_SOURCE[0]:-$0}" ] && readlink -f "${BASH_SOURCE[0]:-$0}" || echo "${BASH_SOURCE[0]:-$0}"))" >/dev/null 2>&1 ; pwd -P )"; - -# load common package manager helper functions -. "$script_dir/../../common/common.sh" - -# Create a temporary directory -tmp_dir=$(mktemp -d "${TMPDIR:-/tmp/}generate-docs-async-api-markdown.XXXXXXXXX") -cd $tmp_dir - -log "async-api-markdown :: tmp_dir :: $tmp_dir" - -# Install dependencies -install_packages - -# Generate -run_command asyncapi generate fromTemplate "$working_dir/$spec_path" @asyncapi/markdown-template@1.5.0 \ - --param outFilename=index.md \ - --force-write - -# Copy markdown docs to output path -rm -f $working_dir/$output_path/index.md -cp index.md $working_dir/$output_path/index.md - -echo "AsyncAPI Markdown documentation generation done!" - -# Clean up -cd $working_dir -rm -rf $tmp_dir diff --git a/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec b/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec deleted file mode 100755 index 4886b0a03..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -# Parse arguments -spec_path='' -output_path='' -while [[ "$#" -gt 0 ]]; do case $1 in - --spec-path) spec_path="$2"; shift;; - --output-path) output_path="$2"; shift;; -esac; shift; done - -working_dir=$(pwd) -script_dir="$( cd -- "$(dirname $([ -L "${BASH_SOURCE[0]:-$0}" ] && readlink -f "${BASH_SOURCE[0]:-$0}" || echo "${BASH_SOURCE[0]:-$0}"))" >/dev/null 2>&1 ; pwd -P )"; - -# load common package manager helper functions -. "$script_dir/../../common/common.sh" - -# Create a temporary directory -tmp_dir=$(mktemp -d "${TMPDIR:-/tmp/}generate-asyncapi-spec.XXXXXXXXX") -cd $tmp_dir - -log "generate-asyncapi-spec :: tmp_dir :: $tmp_dir" - -# Copy the parse script into the temp directory -cp -r $script_dir/* . - -# Install dependencies -install_packages - -# Run the parse script -run_command ts-node generate-asyncapi-spec.ts \ - --specPath="$working_dir/$spec_path" \ - --outputPath="$working_dir/$output_path" - -log "generate-asyncapi-spec :: done" - -# Clean up -cd $working_dir -rm -rf $tmp_dir diff --git a/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec.ts b/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec.ts index c54b135ae..756edcb61 100644 --- a/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec.ts +++ b/packages/type-safe-api/scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec.ts @@ -125,11 +125,11 @@ const generateAsyncApiSpec = (openApiSpec: any): any => { }; }; -void (async () => { +export default async (argv: string[]) => { const args = parse({ specPath: { type: String, alias: "s" }, outputPath: { type: String, alias: "o" }, - }); + }, { argv }); const openApiSpec = (await SwaggerParser.bundle(args.specPath)) as any; @@ -138,4 +138,4 @@ void (async () => { writeFile(args.outputPath, JSON.stringify(asyncApiSpec, null, 2), { readonly: true, }); -})(); +}; diff --git a/packages/type-safe-api/scripts/type-safe-api/run.ts b/packages/type-safe-api/scripts/type-safe-api/run.ts index fd583e595..fa9f3224b 100644 --- a/packages/type-safe-api/scripts/type-safe-api/run.ts +++ b/packages/type-safe-api/scripts/type-safe-api/run.ts @@ -3,6 +3,7 @@ import { parse } from "ts-command-line-args"; import generateMockData from "./custom/mock-data/generate-mock-data"; import parseOpenapiSpec from "./parser/parse-openapi-spec"; import generate from "./generators/generate-next"; +import generateAsyncapiSpec from "./custom/generate-asyncapi-spec/generate-asyncapi-spec"; import * as path from "path"; interface SubCommandArgs { @@ -21,6 +22,8 @@ void (async () => { return await generateMockData(argv); case "parse-openapi-spec": return await parseOpenapiSpec(argv); + case "generate-asyncapi-spec": + return await generateAsyncapiSpec(argv); case "generate": return await generate(argv, path.resolve(__dirname)); default: diff --git a/packages/type-safe-api/src/project/codegen/components/utils.ts b/packages/type-safe-api/src/project/codegen/components/utils.ts index 9391dfa15..434204282 100644 --- a/packages/type-safe-api/src/project/codegen/components/utils.ts +++ b/packages/type-safe-api/src/project/codegen/components/utils.ts @@ -42,13 +42,10 @@ export enum TypeSafeApiScript { GENERATE = "type-safe-api.generate", GENERATE_NEXT = "type-safe-api generate", GENERATE_MOCK_DATA = "type-safe-api generate-mock-data", - GENERATE_HTML_REDOC_DOCS = "type-safe-api.generate-html-redoc-docs", - GENERATE_ASYNCAPI_HTML_DOCS = "type-safe-api.generate-asyncapi-html-docs", - GENERATE_ASYNCAPI_MARKDOWN_DOCS = "type-safe-api.generate-asyncapi-markdown-docs", CLEAN_OPENAPI_GENERATED_CODE = "type-safe-api.clean-openapi-generated-code", COPY_GRADLE_WRAPPER = "type-safe-api.copy-gradle-wrapper", COPY_ASYNC_SMITHY_TRANSFORMER = "type-safe-api.copy-async-smithy-transformer", - GENERATE_ASYNCAPI_SPEC = "type-safe-api.generate-asyncapi-spec", + GENERATE_ASYNCAPI_SPEC = "type-safe-api generate-asyncapi-spec", } /** diff --git a/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-html-documentation-project.ts b/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-html-documentation-project.ts index 8e91d6d73..00564bbb0 100644 --- a/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-html-documentation-project.ts +++ b/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-html-documentation-project.ts @@ -3,10 +3,6 @@ SPDX-License-Identifier: Apache-2.0 */ import { Project, ProjectOptions, Task } from "projen"; import { GeneratedAsyncApiHtmlDocumentationOptions } from "../../types"; import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment"; -import { - buildTypeSafeApiExecCommand, - TypeSafeApiScript, -} from "../components/utils"; export interface GeneratedAsyncApiHtmlDocumentationProjectOptions extends ProjectOptions, @@ -26,11 +22,9 @@ export class GeneratedAsyncApiHtmlDocumentationProject extends Project { this.generateTask = this.addTask("generate"); this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE_ASYNCAPI_HTML_DOCS, - `--spec-path ${options.specPath} --output-path .` - ) + `npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "${options.specPath}" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write` ); + this.compileTask.spawn(this.generateTask); if (!options.commitGeneratedCode) { diff --git a/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-markdown-documentation-project.ts b/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-markdown-documentation-project.ts index 4f4a697b6..b14a7083b 100644 --- a/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-markdown-documentation-project.ts +++ b/packages/type-safe-api/src/project/codegen/documentation/generated-asyncapi-markdown-documentation-project.ts @@ -3,10 +3,6 @@ SPDX-License-Identifier: Apache-2.0 */ import { Project, ProjectOptions, Task } from "projen"; import { GeneratedAsyncApiMarkdownDocumentationOptions } from "../../types"; import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment"; -import { - buildTypeSafeApiExecCommand, - TypeSafeApiScript, -} from "../components/utils"; export interface GeneratedAsyncApiMarkdownDocumentationProjectOptions extends ProjectOptions, @@ -26,10 +22,7 @@ export class GeneratedAsyncApiMarkdownDocumentationProject extends Project { this.generateTask = this.addTask("generate"); this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE_ASYNCAPI_MARKDOWN_DOCS, - `--spec-path ${options.specPath} --output-path .` - ) + `npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "${options.specPath}" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write` ); this.compileTask.spawn(this.generateTask); diff --git a/packages/type-safe-api/src/project/model/type-safe-websocket-api-model-project.ts b/packages/type-safe-api/src/project/model/type-safe-websocket-api-model-project.ts index a6cc8f81d..e4ca0befb 100644 --- a/packages/type-safe-api/src/project/model/type-safe-websocket-api-model-project.ts +++ b/packages/type-safe-api/src/project/model/type-safe-websocket-api-model-project.ts @@ -59,7 +59,7 @@ export class TypeSafeWebSocketApiModelProject extends TypeSafeApiModelProjectBas this.generateTask.exec( buildTypeSafeApiExecCommand( TypeSafeApiScript.GENERATE_ASYNCAPI_SPEC, - `--spec-path ${this.parsedSpecFile} --output-path ${this.asyncApiSpecFile}` + `--specPath ${this.parsedSpecFile} --outputPath ${this.asyncApiSpecFile}` ) ); diff --git a/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap b/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap index 25a5209dd..67cf50d7d 100644 --- a/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap +++ b/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap @@ -191,7 +191,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -347,7 +347,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -1723,7 +1723,7 @@ node_modules/ "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath src/main/openapi/main.yaml --outputPath .api.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -3253,7 +3253,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -3611,7 +3611,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -5312,7 +5312,7 @@ node_modules/ "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath src/main/openapi/main.yaml --outputPath .api.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -8433,7 +8433,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-handlers-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-handlers-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -11510,7 +11510,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-typescript-websocket-hooks-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-typescript-websocket-hooks-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -12105,7 +12105,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -12261,7 +12261,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -13656,7 +13656,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-npm-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-npm-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -15386,7 +15386,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -15744,7 +15744,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -17471,7 +17471,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-npm-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-npm-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -18461,7 +18461,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -18617,7 +18617,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -20019,7 +20019,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-pnpm-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-pnpm-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -21765,7 +21765,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -22123,7 +22123,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -23854,7 +23854,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-pnpm-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-pnpm-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -24850,7 +24850,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -25006,7 +25006,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -26408,7 +26408,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-typescript-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-typescript-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -28139,7 +28139,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -28497,7 +28497,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -30224,7 +30224,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-typescript-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-typescript-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -31214,7 +31214,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -31370,7 +31370,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -32784,7 +32784,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-yarn_berry-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-yarn_berry-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -34536,7 +34536,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -34894,7 +34894,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -36659,7 +36659,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-yarn_berry-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-yarn_berry-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -37649,7 +37649,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -37805,7 +37805,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -39200,7 +39200,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-yarn_classic-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-yarn_classic-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -40931,7 +40931,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, @@ -41289,7 +41289,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path ../../../model/.asyncapi.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "../../../model/.asyncapi.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, @@ -43016,7 +43016,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-yarn_classic-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-yarn_classic-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, diff --git a/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-html-documentation-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-html-documentation-project.test.ts.snap index 89a10c109..4af0880be 100644 --- a/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-html-documentation-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-html-documentation-project.test.ts.snap @@ -79,7 +79,7 @@ index.html "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-html-docs --spec-path my-asyncapi-spec.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "my-asyncapi-spec.json" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write", }, ], }, diff --git a/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-markdown-documentation-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-markdown-documentation-project.test.ts.snap index e2f9f8f69..091241e66 100644 --- a/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-markdown-documentation-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/documentation/__snapshots__/generated-asyncapi-markdown-documentation-project.test.ts.snap @@ -79,7 +79,7 @@ index.md "name": "generate", "steps": [ { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-markdown-docs --spec-path my-asyncapi-spec.json --output-path .", + "exec": "npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "my-asyncapi-spec.json" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write", }, ], }, diff --git a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap index a12250dbe..c19a78d47 100644 --- a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap +++ b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap @@ -83,7 +83,7 @@ node_modules/ "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath src/main/openapi/main.yaml --outputPath .api.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -369,7 +369,7 @@ node_modules/ "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath src/main/openapi/main.yaml --outputPath .api.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -685,7 +685,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-async-model/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-async-model/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, @@ -1198,7 +1198,7 @@ smithy-output "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath build/smithyprojections/smithy-async-handlers/openapi/openapi/MyService.openapi.json --outputPath .api.json --smithyJsonPath build/smithyprojections/smithy-async-handlers/openapi/model/model.json", }, { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-asyncapi-spec --spec-path .api.json --output-path .asyncapi.json", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", }, ], }, diff --git a/packages/type-safe-api/test/scripts/custom/generate-asyncapi-spec/generate-asyncapi-spec.test.ts b/packages/type-safe-api/test/scripts/custom/generate-asyncapi-spec/generate-asyncapi-spec.test.ts index b2b656037..9afed4d3f 100644 --- a/packages/type-safe-api/test/scripts/custom/generate-asyncapi-spec/generate-asyncapi-spec.test.ts +++ b/packages/type-safe-api/test/scripts/custom/generate-asyncapi-spec/generate-asyncapi-spec.test.ts @@ -16,7 +16,7 @@ describe("Generate AsyncAPI Spec Unit Tests", () => { path.relative(path.resolve(__dirname), tmpDir), ".asyncapi.json" ); - const command = `../../../../scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec --spec-path ${specPath} --output-path ${outputPath}`; + const command = `../../../../scripts/type-safe-api/run.js generate-asyncapi-spec --specPath ${specPath} --outputPath ${outputPath}`; exec(command, { cwd: path.resolve(__dirname), }); diff --git a/packages/type-safe-api/test/scripts/generators/__snapshots__/docs.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/docs.test.ts.snap index cefbf8615..906f54fda 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/docs.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/docs.test.ts.snap @@ -1,104 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Docs Generation Script Unit Tests Generates AsyncAPI Markdown docs 1`] = ` -{ - "index.md": "# MyService 1.0 documentation - -A sample smithy websocket api - -## Table of Contents - - -## Operations - -### RECEIVE \`/\` Operation - -* Operation ID: \`OnSendNotification\` - -#### Message SendNotification \`SendNotification\` - -*Send a notification to a connected client* - -* Message ID: \`SendNotification\` -* Content type: [application/json](https://www.iana.org/assignments/media-types/application/json) - -##### Payload - -| Name | Type | Description | Value | Constraints | Notes | -|---|---|---|---|---|---| -| (root) | object | - | - | - | **additional properties are allowed** | -| route | string | - | const (\`"SendNotification"\`) | - | **required** | -| payload | object | - | - | - | **required**, **additional properties are allowed** | -| payload.topic | string | - | - | - | **required** | -| payload.title | string | - | - | - | **required** | -| payload.message | string | - | - | - | **required** | - -> Examples of payload _(generated)_ - -\`\`\`json -{ - "route": "SendNotification", - "payload": { - "topic": "string", - "title": "string", - "message": "string" - } -} -\`\`\` - - -##### Message tags - -| Name | Description | Documentation | -|---|---|---| -| Default | - | - | -| Foo | - | - | - - -### SEND \`/\` Operation - -* Operation ID: \`SubscribeToNotifications\` - -#### Message SubscribeToNotifications \`SubscribeToNotifications\` - -*Subscribe to notifications* - -* Message ID: \`SubscribeToNotifications\` -* Content type: [application/json](https://www.iana.org/assignments/media-types/application/json) - -##### Payload - -| Name | Type | Description | Value | Constraints | Notes | -|---|---|---|---|---|---| -| (root) | object | - | - | - | **additional properties are allowed** | -| route | string | - | const (\`"SubscribeToNotifications"\`) | - | **required** | -| payload | object | - | - | - | **required**, **additional properties are allowed** | -| payload.topic | string | - | - | - | **required** | - -> Examples of payload _(generated)_ - -\`\`\`json -{ - "route": "SubscribeToNotifications", - "payload": { - "topic": "string" - } -} -\`\`\` - - -##### Message tags - -| Name | Description | Documentation | -|---|---|---| -| Default | - | - | -| Bar | - | - | - - -", -} -`; - exports[`Docs Generation Script Unit Tests Generates html2 1`] = ` { ".openapi-generator-ignore": "# OpenAPI Generator Ignore diff --git a/packages/type-safe-api/test/scripts/generators/docs.test.ts b/packages/type-safe-api/test/scripts/generators/docs.test.ts index 329e8876e..da2631a59 100644 --- a/packages/type-safe-api/test/scripts/generators/docs.test.ts +++ b/packages/type-safe-api/test/scripts/generators/docs.test.ts @@ -63,32 +63,4 @@ describe("Docs Generation Script Unit Tests", () => { ) ).toMatchSnapshot(); }); - - it("Generates AsyncAPI Markdown docs", () => { - const specPath = path.resolve( - __dirname, - "../../resources/specs/async/asyncapi/sample.json" - ); - - expect( - withTmpDirSnapshot( - os.tmpdir(), - (outdir) => { - exec(`cp ${specPath} ${outdir}/asyncapi.json`, { - cwd: path.resolve(__dirname), - }); - exec( - `${path.resolve( - __dirname, - "../../../scripts/type-safe-api/custom/docs/asyncapi-markdown" - )} --spec-path asyncapi.json --output-path .`, - { - cwd: outdir, - } - ); - }, - { excludeGlobs: ["asyncapi.json"] } - ) - ).toMatchSnapshot(); - }); }); diff --git a/projenrc/projects/type-safe-api-project.ts b/projenrc/projects/type-safe-api-project.ts index 90e796899..9642efd95 100644 --- a/projenrc/projects/type-safe-api-project.ts +++ b/projenrc/projects/type-safe-api-project.ts @@ -68,8 +68,6 @@ export class TypeSafeApiProject extends PDKProject { publishConfig: { executableFiles: [ "scripts/type-safe-api/common/common.sh", - "scripts/type-safe-api/custom/docs/asyncapi-html", - "scripts/type-safe-api/custom/docs/asyncapi-markdown", "scripts/type-safe-api/generators/generate", "scripts/type-safe-api/run.js", "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", @@ -77,24 +75,17 @@ export class TypeSafeApiProject extends PDKProject { "scripts/type-safe-api/custom/gradle-wrapper/gradlew", "scripts/type-safe-api/custom/gradle-wrapper/gradlew.bat", "scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", - "scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec", ], }, bin: { "type-safe-api": "scripts/type-safe-api/run.js", "type-safe-api.generate": "scripts/type-safe-api/generators/generate", - "type-safe-api.generate-asyncapi-html-docs": - "scripts/type-safe-api/custom/docs/asyncapi-html", - "type-safe-api.generate-asyncapi-markdown-docs": - "scripts/type-safe-api/custom/docs/asyncapi-markdown", "type-safe-api.clean-openapi-generated-code": "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "type-safe-api.copy-gradle-wrapper": "scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper", "type-safe-api.copy-async-smithy-transformer": "scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer", - "type-safe-api.generate-asyncapi-spec": - "scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec", }, });