@gromlab/api-codegen 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -207836,6 +207836,8 @@ async function generate(config) {
|
|
|
207836
207836
|
let url2 = undefined;
|
|
207837
207837
|
if (isUrl) {
|
|
207838
207838
|
url2 = config.inputPath;
|
|
207839
|
+
const response = await fetch(url2);
|
|
207840
|
+
spec = await response.json();
|
|
207839
207841
|
} else {
|
|
207840
207842
|
inputPath = resolve2(config.inputPath);
|
|
207841
207843
|
spec = await readJsonFile(inputPath);
|
|
@@ -207862,7 +207864,7 @@ async function generate(config) {
|
|
|
207862
207864
|
unwrapResponseData: true,
|
|
207863
207865
|
defaultResponseAsSuccess: true,
|
|
207864
207866
|
enumNamesAsValues: false,
|
|
207865
|
-
moduleNameFirstTag:
|
|
207867
|
+
moduleNameFirstTag: true,
|
|
207866
207868
|
generateUnionEnums: false,
|
|
207867
207869
|
extraTemplates: [],
|
|
207868
207870
|
addReadonly: false,
|
|
@@ -207910,7 +207912,7 @@ async function generate(config) {
|
|
|
207910
207912
|
|
|
207911
207913
|
// src/cli.ts
|
|
207912
207914
|
var program2 = new Command;
|
|
207913
|
-
program2.name("api-codegen").description("Generate TypeScript API client from OpenAPI specification").version("1.0.
|
|
207915
|
+
program2.name("api-codegen").description("Generate TypeScript API client from OpenAPI specification").version("1.0.1").requiredOption("-i, --input <path>", "Path to OpenAPI specification file (JSON or YAML)").requiredOption("-o, --output <path>", "Output directory for generated files").option("-n, --name <name>", "Name of generated file (without extension)").option("--swr", "Generate SWR hooks for React").action(async (options) => {
|
|
207914
207916
|
try {
|
|
207915
207917
|
const config = {
|
|
207916
207918
|
inputPath: options.input,
|