@spec2ts/openapi-client 2.0.0-beta.9 → 3.0.0

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/cli/command.js CHANGED
@@ -24,6 +24,14 @@ function builder(argv) {
24
24
  type: "string",
25
25
  alias: "c",
26
26
  describe: "Root directory for resolving $refs"
27
+ })
28
+ .option("baseUrl", {
29
+ type: "string",
30
+ describe: "Base url of the server"
31
+ })
32
+ .option("prefix", {
33
+ type: "string",
34
+ describe: "Only generate paths with this prefix"
27
35
  })
28
36
  .option("avoidAny", {
29
37
  type: "boolean",
@@ -97,13 +105,13 @@ async function handler(options) {
97
105
  if (!options.typesPath.startsWith(".")) {
98
106
  options.typesPath = "./" + options.typesPath;
99
107
  }
100
- const res = await openapi_generator_1.generateClientFromFile(file, options);
108
+ const res = await (0, openapi_generator_1.generateClientFromFile)(file, options);
101
109
  printFile(res.client, output, options);
102
110
  const outputTypes = path.resolve(path.dirname(output), options.typesPath + ".ts");
103
111
  printFile(res.types, outputTypes, options);
104
112
  }
105
113
  else {
106
- const sourceFile = await openapi_generator_1.generateClientFromFile(file, options);
114
+ const sourceFile = await (0, openapi_generator_1.generateClientFromFile)(file, options);
107
115
  printFile(sourceFile, output, options);
108
116
  }
109
117
  if (options.packageName) {
@@ -140,12 +148,12 @@ async function generatePackage(output, options) {
140
148
  main: main.replace(/\.ts$/, ".js"),
141
149
  files: ["*.js", "*.d.ts"],
142
150
  scripts: {
143
- build: `tsc ${main} --strict --target ${options.packageBuildTarget || "ES2018"} --module ${options.packageBuildModule || "UMD"} --moduleResolution node`,
151
+ build: `tsc ${main} --strict --target ${options.packageBuildTarget || "ES2018"} --module ${options.packageBuildModule || "UMD"} --moduleResolution node --skipLibCheck`,
144
152
  prepublishOnly: "npm run build"
145
153
  },
146
154
  dependencies: {},
147
155
  devDependencies: {
148
- typescript: "^3.0.0"
156
+ typescript: "^4.2.0"
149
157
  }
150
158
  };
151
159
  if (options.importFetch) {
package/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,7 @@
1
1
  import * as ts from "typescript";
2
- import type { OpenAPIObject } from "openapi3-ts";
2
+ import type { OpenAPIObject } from "openapi3-ts/oas30";
3
3
  import { OApiGeneratorContext } from "./core-parser";
4
- export declare type Formatter = "space" | "pipe" | "deep" | "explode" | "form";
5
- export declare function generateServers(file: ts.SourceFile, { servers }: OpenAPIObject): ts.SourceFile;
4
+ export type Formatter = "space" | "pipe" | "deep" | "explode" | "form";
5
+ export declare function generateServers(file: ts.SourceFile, { servers }: OpenAPIObject, context: OApiGeneratorContext): ts.SourceFile;
6
6
  export declare function generateDefaults(file: ts.SourceFile, context: OApiGeneratorContext): ts.SourceFile;
7
7
  export declare function generateFunctions(file: ts.SourceFile, spec: OpenAPIObject, context: OApiGeneratorContext): ts.SourceFile;
@@ -8,15 +8,17 @@ const server_parser_1 = require("./server-parser");
8
8
  const core_parser_2 = require("./core-parser");
9
9
  const util_1 = require("./util");
10
10
  //#region Public
11
- function generateServers(file, { servers }) {
11
+ function generateServers(file, { servers }, context) {
12
12
  servers = servers || [];
13
+ if (context.options.baseUrl)
14
+ servers = [{ url: context.options.baseUrl }];
13
15
  const serversConst = core.findFirstVariableStatement(file.statements, "servers");
14
16
  const defaultsConst = core.findFirstVariableStatement(file.statements, "defaults");
15
17
  if (!serversConst || !defaultsConst) {
16
18
  throw new Error("Invalid template: missing servers or defaults const");
17
19
  }
18
- file = core.replaceSourceFileStatement(file, serversConst, core.updateVariableStatementValue(serversConst, "servers", server_parser_1.parseServers(servers)));
19
- file = core.replaceSourceFileStatement(file, defaultsConst, core.updateVariableStatementPropertyValue(defaultsConst, "defaults", "baseUrl", server_parser_1.defaultBaseUrl(servers)));
20
+ file = core.replaceSourceFileStatement(file, serversConst, core.updateVariableStatementValue(serversConst, "servers", (0, server_parser_1.parseServers)(servers)));
21
+ file = core.replaceSourceFileStatement(file, defaultsConst, core.updateVariableStatementPropertyValue(defaultsConst, "defaults", "baseUrl", (0, server_parser_1.defaultBaseUrl)(servers)));
20
22
  return file;
21
23
  }
22
24
  exports.generateServers = generateServers;
@@ -40,16 +42,14 @@ function generateDefaults(file, context) {
40
42
  }
41
43
  exports.generateDefaults = generateDefaults;
42
44
  function generateFunctions(file, spec, context) {
43
- const functions = [];
44
- for (const path in spec.paths) {
45
- const item = core_parser_1.resolveReference(spec.paths[path], context);
46
- for (const verb in item) {
47
- const method = verb.toUpperCase();
48
- if (core_parser_2.isMethod(method)) {
49
- functions.push(generateFunction(path, item, method, item[verb], context));
50
- }
51
- }
52
- }
45
+ const paths = Object.fromEntries(Object.entries(spec.paths)
46
+ .filter(([path]) => !context.options.prefix || path.startsWith(context.options.prefix)));
47
+ const functions = Object.entries(paths).map(([path, pathSpec]) => {
48
+ const item = (0, core_parser_1.resolveReference)(pathSpec, context);
49
+ return Object.entries(item)
50
+ .filter(([verb,]) => (0, core_parser_2.isMethod)(verb.toUpperCase()))
51
+ .map(([verb, entry]) => generateFunction(path, item, verb.toUpperCase(), entry, context));
52
+ }).flat();
53
53
  if (context.options.typesPath && context.typesFile) {
54
54
  context.typesFile = core.updateSourceFileStatements(context.typesFile, context.aliases);
55
55
  file = core.updateSourceFileStatements(file, [
@@ -68,7 +68,7 @@ function generateFunctions(file, spec, context) {
68
68
  }
69
69
  exports.generateFunctions = generateFunctions;
70
70
  function generateFunction(path, item, method, operation, context) {
71
- const { name, query, header, paramsVars, args, bodyMode, bodyVar, response, responseVoid, responseJSON } = core_parser_2.parseOperation(path, item, method, operation, context);
71
+ const { name, query, header, paramsVars, args, bodyMode, bodyVar, response, responseVoid, responseJSON } = (0, core_parser_2.parseOperation)(path, item, method, operation, context);
72
72
  const qs = generateQs(query, paramsVars);
73
73
  const url = generateUrl(path, qs);
74
74
  const init = [
@@ -115,7 +115,7 @@ function generateUrl(path, qs) {
115
115
  const spans = [];
116
116
  // Use a replacer function to collect spans as a side effect:
117
117
  const head = path.replace(/(.*?)\{(.+?)\}(.*?)(?=\{|$)/g, (_, head, name, literal) => {
118
- const expression = util_1.camelCase(name);
118
+ const expression = (0, util_1.camelCase)(name);
119
119
  spans.push({ expression: ts.factory.createIdentifier(expression), literal });
120
120
  return head;
121
121
  });
@@ -1,9 +1,9 @@
1
1
  import * as ts from "typescript";
2
- import type { PathItemObject, OperationObject, ParameterObject } from "openapi3-ts";
2
+ import type { PathItemObject, OperationObject, ParameterObject } from "openapi3-ts/oas30";
3
3
  import { ParserContext } from "@spec2ts/jsonschema/lib/core-parser";
4
4
  import type { OApiGeneratorOptions } from "./openapi-generator";
5
- export declare type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE";
6
- export declare type ContentTypeMode = "json" | "form" | "multipart";
5
+ export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE";
6
+ export type ContentTypeMode = "json" | "form" | "multipart";
7
7
  export interface OApiGeneratorContext extends ParserContext {
8
8
  options: OApiGeneratorOptions;
9
9
  typesFile?: ts.SourceFile;
@@ -38,7 +38,7 @@ function parseArgs(result, item, operation, context) {
38
38
  }));
39
39
  }
40
40
  function parseResponses(result, path, method, operation, context) {
41
- const operationName = core_parser_2.getOperationName(method, path, operation.operationId, context);
41
+ const operationName = (0, core_parser_2.getOperationName)(method, path, operation.operationId, context);
42
42
  result.response = getTypeFromResponses(operationName, operation.responses, context);
43
43
  result.responseJSON = isJSONResponse(operation.responses, context);
44
44
  result.responseVoid = result.response === core.keywordType.void;
@@ -57,7 +57,7 @@ function parseParameters(result, item, operation, context) {
57
57
  objectBindingParams = optional;
58
58
  required.forEach(p => {
59
59
  result.args.push(core.createParameter(argNames[p.name], {
60
- type: core_parser_1.getTypeFromSchema(p.schema, context),
60
+ type: (0, core_parser_1.getTypeFromSchema)(p.schema, context),
61
61
  }));
62
62
  });
63
63
  }
@@ -69,15 +69,15 @@ function parseParameters(result, item, operation, context) {
69
69
  type: ts.factory.createTypeLiteralNode(objectBindingParams.map((p) => core.createPropertySignature({
70
70
  name: argNames[p.name],
71
71
  questionToken: !p.required,
72
- type: core_parser_1.getTypeFromSchema(p.schema, context)
72
+ type: (0, core_parser_1.getTypeFromSchema)(p.schema, context)
73
73
  }))),
74
74
  }));
75
75
  }
76
76
  function parseRequestBody(result, requestBody, context) {
77
- const body = core_parser_1.resolveReference(requestBody, context);
77
+ const body = (0, core_parser_1.resolveReference)(requestBody, context);
78
78
  const [schema, mode] = getSchemaFromContent(body.content);
79
- const type = core_parser_1.getTypeFromSchema(schema, context);
80
- const bodyVar = result.bodyVar = util_1.camelCase(type.name || getReferenceName(schema) || "body");
79
+ const type = (0, core_parser_1.getTypeFromSchema)(schema, context);
80
+ const bodyVar = result.bodyVar = (0, util_1.camelCase)(type.name || getReferenceName(schema) || "body");
81
81
  result.bodyMode = mode;
82
82
  result.args.push(core.createParameter(bodyVar, { type }));
83
83
  }
@@ -85,9 +85,9 @@ function createParametersNames(parameters) {
85
85
  const argNames = {};
86
86
  parameters.forEach(({ name }) => {
87
87
  // strip leading namespaces, eg. foo.name -> name
88
- const stripped = util_1.camelCase(name.replace(/.+\./, ""));
88
+ const stripped = (0, util_1.camelCase)(name.replace(/.+\./, ""));
89
89
  // keep the prefix if the stripped-down name is already taken
90
- argNames[name] = stripped in argNames ? util_1.camelCase(name) : stripped;
90
+ argNames[name] = stripped in argNames ? (0, util_1.camelCase)(name) : stripped;
91
91
  });
92
92
  return argNames;
93
93
  }
@@ -114,7 +114,7 @@ function getTypeFromResponses(operationName, res, context) {
114
114
  isOK && types.push(type);
115
115
  }
116
116
  else {
117
- const name = core_parser_2.getResponseName(operationName, code, context);
117
+ const name = (0, core_parser_2.getResponseName)(operationName, code, context);
118
118
  context.aliases.push(core.createTypeOrInterfaceDeclaration({
119
119
  modifiers: [core.modifier.export],
120
120
  name, type
@@ -136,7 +136,7 @@ function isJSONResponse(responses, context) {
136
136
  if (!resCode) {
137
137
  return false;
138
138
  }
139
- const response = core_parser_1.resolveReference(responses[resCode], context);
139
+ const response = (0, core_parser_1.resolveReference)(responses[resCode], context);
140
140
  return (!!((_a = response === null || response === void 0 ? void 0 : response.content) === null || _a === void 0 ? void 0 : _a["application/json"]) ||
141
141
  !!((_b = response === null || response === void 0 ? void 0 : response.content) === null || _b === void 0 ? void 0 : _b["*/*"]));
142
142
  }
@@ -152,11 +152,11 @@ exports.isMethod = isMethod;
152
152
  //#endregion
153
153
  //#region Private
154
154
  function getTypeFromResponse(res, context) {
155
- res = core_parser_1.resolveReference(res, context);
155
+ res = (0, core_parser_1.resolveReference)(res, context);
156
156
  if (!(res === null || res === void 0 ? void 0 : res.content)) {
157
157
  return core.keywordType.void;
158
158
  }
159
- return core_parser_1.getTypeFromSchema(getSchemaFromContent(res.content)[0], context);
159
+ return (0, core_parser_1.getTypeFromSchema)(getSchemaFromContent(res.content)[0], context);
160
160
  }
161
161
  function getSchemaFromContent(content) {
162
162
  var _a;
@@ -172,11 +172,11 @@ function getSchemaFromContent(content) {
172
172
  }
173
173
  function resolveReferences(array, context) {
174
174
  var _a;
175
- return (_a = array === null || array === void 0 ? void 0 : array.map(ref => core_parser_1.resolveReference(ref, context))) !== null && _a !== void 0 ? _a : [];
175
+ return (_a = array === null || array === void 0 ? void 0 : array.map(ref => (0, core_parser_1.resolveReference)(ref, context))) !== null && _a !== void 0 ? _a : [];
176
176
  }
177
177
  function getReferenceName(obj) {
178
- if (core_parser_1.isReference(obj)) {
179
- return util_1.camelCase(obj.$ref.split("/").slice(-1)[0]);
178
+ if ((0, core_parser_1.isReference)(obj)) {
179
+ return (0, util_1.camelCase)(obj.$ref.split("/").slice(-1)[0]);
180
180
  }
181
181
  }
182
182
  /**
@@ -220,7 +220,7 @@ function getOperationVar(verb, path, operationId, context) {
220
220
  }
221
221
  function getPathVar(path, context) {
222
222
  path = path.replace(/\{(.+?)\}/, "by $1").replace(/\{(.+?)\}/g, "and $1");
223
- let name = util_1.camelCase(path);
223
+ let name = (0, util_1.camelCase)(path);
224
224
  const count = (context.names[name] = (context.names[name] || 0) + 1);
225
225
  if (count > 1) {
226
226
  name += count;
@@ -232,7 +232,7 @@ function getOperationVarId(id) {
232
232
  return;
233
233
  if (id.match(/[^\w\s]/))
234
234
  return;
235
- id = util_1.camelCase(id);
235
+ id = (0, util_1.camelCase)(id);
236
236
  if (core.isValidIdentifier(id))
237
237
  return id;
238
238
  }
@@ -1,10 +1,12 @@
1
1
  import * as ts from "typescript";
2
- import type { OpenAPIObject } from "openapi3-ts";
2
+ import type { OpenAPIObject } from "openapi3-ts/oas30";
3
3
  import { ParserOptions } from "@spec2ts/jsonschema/lib/core-parser";
4
4
  export interface OApiGeneratorOptions extends ParserOptions {
5
5
  inlineRequired?: boolean;
6
6
  importFetch?: "node-fetch" | "cross-fetch" | "isomorphic-fetch";
7
7
  typesPath?: string;
8
+ baseUrl?: string;
9
+ prefix?: string;
8
10
  }
9
11
  export declare function generateClientFromFile(file: string, options: OApiGeneratorOptions & {
10
12
  typesPath: string;
@@ -4,12 +4,12 @@ exports.generateClient = exports.generateClientFromFile = void 0;
4
4
  const path = require("path");
5
5
  const ts = require("typescript");
6
6
  const core = require("@spec2ts/core");
7
- const $RefParser = require("@apidevtools/json-schema-ref-parser");
7
+ const json_schema_ref_parser_1 = require("@apidevtools/json-schema-ref-parser");
8
8
  const core_parser_1 = require("@spec2ts/jsonschema/lib/core-parser");
9
9
  const core_parser_2 = require("@spec2ts/openapi/lib/core-parser");
10
10
  const core_generator_1 = require("./core-generator");
11
11
  async function generateClientFromFile(file, options = {}) {
12
- const schema = await $RefParser.parse(file);
12
+ const schema = await (0, json_schema_ref_parser_1.parse)(file);
13
13
  return generateClient(schema, {
14
14
  cwd: path.resolve(path.dirname(file)) + "/",
15
15
  ...options
@@ -20,14 +20,14 @@ async function generateClient(spec, options = {}) {
20
20
  if (!options.parseReference) {
21
21
  options.parseReference = core_parser_2.parseReference;
22
22
  }
23
- const context = await core_parser_1.createContext(spec, options);
23
+ const context = await (0, core_parser_1.createContext)(spec, options);
24
24
  let file = await core.createSourceFileFromFile(__dirname + "/templates/_client.tpl.ts");
25
25
  if (context.options.typesPath) {
26
26
  context.typesFile = ts.createSourceFile("types.ts", "", ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
27
27
  }
28
- file = core_generator_1.generateServers(file, spec);
29
- file = core_generator_1.generateDefaults(file, context);
30
- file = core_generator_1.generateFunctions(file, spec, context);
28
+ file = (0, core_generator_1.generateServers)(file, spec, context);
29
+ file = (0, core_generator_1.generateDefaults)(file, context);
30
+ file = (0, core_generator_1.generateFunctions)(file, spec, context);
31
31
  if (context.options.typesPath) {
32
32
  return {
33
33
  client: file,
@@ -1,4 +1,4 @@
1
1
  import * as ts from "typescript";
2
- import type { ServerObject } from "openapi3-ts";
2
+ import type { ServerObject } from "openapi3-ts/oas30";
3
3
  export declare function parseServers(servers: ServerObject[]): ts.ObjectLiteralExpression;
4
4
  export declare function defaultBaseUrl(servers: ServerObject[]): ts.StringLiteral;
@@ -15,7 +15,7 @@ function defaultBaseUrl(servers) {
15
15
  exports.defaultBaseUrl = defaultBaseUrl;
16
16
  function serverName(server, index) {
17
17
  return server.description ?
18
- util_1.camelCase(server.description.replace(/\W+/, " ")) :
18
+ (0, util_1.camelCase)(server.description.replace(/\W+/, " ")) :
19
19
  `server${index + 1}`;
20
20
  }
21
21
  function generateServerExpression(server) {
@@ -1,28 +1,28 @@
1
1
  export declare const defaults: RequestOptions;
2
2
  export declare const servers: {};
3
- export declare type RequestOptions = {
3
+ export type RequestOptions = {
4
4
  baseUrl?: string;
5
5
  fetch?: typeof fetch;
6
6
  headers?: Record<string, string | undefined>;
7
7
  } & Omit<RequestInit, "body" | "headers">;
8
- export declare type ApiResponse<T> = {
8
+ export type ApiResponse<T> = {
9
9
  status: number;
10
10
  statusText: string;
11
11
  headers: Record<string, string>;
12
12
  data: T;
13
13
  };
14
- declare type Encoders = Array<(s: string) => string>;
15
- declare type TagFunction = (strings: TemplateStringsArray, ...values: any[]) => string;
16
- declare type FetchRequestOptions = RequestOptions & {
14
+ type Encoders = Array<(s: string) => string>;
15
+ type TagFunction = (strings: TemplateStringsArray, ...values: any[]) => string;
16
+ type FetchRequestOptions = RequestOptions & {
17
17
  body?: string | FormData;
18
18
  };
19
- declare type JsonRequestOptions = RequestOptions & {
19
+ type JsonRequestOptions = RequestOptions & {
20
20
  body: unknown;
21
21
  };
22
- declare type FormRequestOptions<T extends Record<string, unknown>> = RequestOptions & {
22
+ type FormRequestOptions<T extends Record<string, unknown>> = RequestOptions & {
23
23
  body: T;
24
24
  };
25
- declare type MultipartRequestOptions = RequestOptions & {
25
+ type MultipartRequestOptions = RequestOptions & {
26
26
  body: Record<string, any>;
27
27
  };
28
28
  /** Utilities functions */
@@ -35,7 +35,7 @@ export declare const _: {
35
35
  /** Creates a tag-function to encode template strings with the given encoders. */
36
36
  encode(encoders: Encoders, delimiter?: string): TagFunction;
37
37
  /** Separate array values by the given delimiter. */
38
- delimited(delimiter?: string): (params: Record<string, any>, encoders?: Encoders | undefined) => string;
38
+ delimited(delimiter?: string): (params: Record<string, any>, encoders?: Encoders) => string;
39
39
  /** Join URLs parts. */
40
40
  joinUrl(...parts: Array<string | undefined>): string;
41
41
  };
@@ -55,13 +55,13 @@ export declare const QS: {
55
55
  * See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#encoding-object
56
56
  */
57
57
  explode(params: Record<string, any>, encoders?: (typeof encodeURI)[]): string;
58
- form: (params: Record<string, any>, encoders?: Encoders | undefined) => string;
59
- pipe: (params: Record<string, any>, encoders?: Encoders | undefined) => string;
60
- space: (params: Record<string, any>, encoders?: Encoders | undefined) => string;
58
+ form: (params: Record<string, any>, encoders?: Encoders) => string;
59
+ pipe: (params: Record<string, any>, encoders?: Encoders) => string;
60
+ space: (params: Record<string, any>, encoders?: Encoders) => string;
61
61
  };
62
62
  /** Http request base methods. */
63
63
  export declare const http: {
64
- fetch(url: string, req?: FetchRequestOptions | undefined): Promise<ApiResponse<string | undefined>>;
64
+ fetch(url: string, req?: FetchRequestOptions): Promise<ApiResponse<string | undefined>>;
65
65
  fetchJson(url: string, req?: FetchRequestOptions): Promise<ApiResponse<any>>;
66
66
  fetchVoid(url: string, req?: FetchRequestOptions): Promise<ApiResponse<undefined>>;
67
67
  json({ body, headers, ...req }: JsonRequestOptions): FetchRequestOptions;
@@ -77,5 +77,5 @@ export declare class HttpError extends Error {
77
77
  constructor(status: number, statusText: string, url: string, headers: Headers, text?: string);
78
78
  }
79
79
  /** Utility Type to extract returns type from a method. */
80
- export declare type ApiResult<Fn> = Fn extends (...args: any) => Promise<ApiResponse<infer T>> ? T : never;
80
+ export type ApiResult<Fn> = Fn extends (...args: any) => Promise<ApiResponse<infer T>> ? T : never;
81
81
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spec2ts/openapi-client",
3
- "version": "2.0.0-beta.9",
3
+ "version": "3.0.0",
4
4
  "description": "Utility to convert OpenAPI v3 specifications to Typescript HTTP client using TypeScript native compiler",
5
5
  "author": "Touchify <dev@touchify.co>",
6
6
  "license": "MIT",
@@ -33,24 +33,24 @@
33
33
  "test:jest": "jest -c ../../jest.config.js --rootDir .",
34
34
  "test:coverage": "npm run test -- -- --coverage",
35
35
  "lint": "npm run lint:ts",
36
- "lint:ts": "eslint \"*.ts\" \"{bin,cli,lib}/**/*.ts\"",
36
+ "lint:ts": "eslint '*.ts' '{bin,cli,lib}/**/*.ts'",
37
37
  "lint:fix": "npm run lint -- -- --fix",
38
38
  "clean": "npm run clean:ts",
39
- "clean:ts": "rimraf *.{js,d.ts} {bin,cli,lib}/**/*.{js,d.ts}",
39
+ "clean:ts": "del '*.{js,d.ts}' '{bin,cli,lib}/**/*.{js,d.ts}'",
40
40
  "prepublishOnly": "npm test && npm run build"
41
41
  },
42
42
  "dependencies": {
43
- "@spec2ts/core": "^2.0.0-beta.2",
44
- "@spec2ts/jsonschema": "^2.0.0-beta.6",
45
- "@spec2ts/openapi": "^2.0.0-beta.6",
46
- "openapi3-ts": "^1.3.0",
47
- "yargs": "^15.3.1"
43
+ "@spec2ts/core": "^3.0.0",
44
+ "@spec2ts/jsonschema": "^3.0.0",
45
+ "@spec2ts/openapi": "^3.0.0",
46
+ "openapi3-ts": "^4.1.2",
47
+ "yargs": "^17.7.2"
48
48
  },
49
49
  "devDependencies": {
50
- "eslint": "^7.11.0",
51
- "jest": "^26.5.3",
52
- "rimraf": "^3.0.2",
53
- "typescript": "^4.0.0"
50
+ "del-cli": "^5.1.0",
51
+ "eslint": "^8.49.0",
52
+ "jest": "^29.6.4",
53
+ "typescript": "^5.2.2"
54
54
  },
55
55
  "keywords": [
56
56
  "openapi",
@@ -70,5 +70,5 @@
70
70
  "spec2ts",
71
71
  "share"
72
72
  ],
73
- "gitHead": "5717dc6d2eb06bdcebea9eff4339f5d4bd6ac140"
73
+ "gitHead": "4a0c2fc9068a9ca8cc0d8924c4b1998528b48052"
74
74
  }
package/CHANGELOG.md DELETED
@@ -1,245 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [2.0.0-beta.9](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.8...@spec2ts/openapi-client@2.0.0-beta.9) (2022-01-27)
7
-
8
- **Note:** Version bump only for package @spec2ts/openapi-client
9
-
10
-
11
-
12
-
13
-
14
- # [2.0.0-beta.8](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.7...@spec2ts/openapi-client@2.0.0-beta.8) (2021-11-03)
15
-
16
- **Note:** Version bump only for package @spec2ts/openapi-client
17
-
18
-
19
-
20
-
21
-
22
- # [2.0.0-beta.7](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.6...@spec2ts/openapi-client@2.0.0-beta.7) (2021-10-23)
23
-
24
- **Note:** Version bump only for package @spec2ts/openapi-client
25
-
26
-
27
-
28
-
29
-
30
- # [2.0.0-beta.6](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.5...@spec2ts/openapi-client@2.0.0-beta.6) (2021-02-27)
31
-
32
- **Note:** Version bump only for package @spec2ts/openapi-client
33
-
34
-
35
-
36
-
37
-
38
- # [2.0.0-beta.5](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.4...@spec2ts/openapi-client@2.0.0-beta.5) (2020-12-21)
39
-
40
-
41
- ### Bug Fixes
42
-
43
- * **openapi-client:** allow $ and _ in camelCase ([08c244e](https://github.com/touchifyapp/spec2ts/commit/08c244eb6e2c0a6f3ab833faa5159483ca1adda7))
44
-
45
-
46
-
47
-
48
-
49
- # [2.0.0-beta.4](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.3...@spec2ts/openapi-client@2.0.0-beta.4) (2020-12-14)
50
-
51
-
52
- ### Bug Fixes
53
-
54
- * **openapi-client:** type issue in TS 4.1 ([09da142](https://github.com/touchifyapp/spec2ts/commit/09da1423ce16e1a8ccee81ba0ad160f5f6313a67))
55
-
56
-
57
-
58
-
59
-
60
- # [2.0.0-beta.3](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.2...@spec2ts/openapi-client@2.0.0-beta.3) (2020-11-29)
61
-
62
-
63
- ### Bug Fixes
64
-
65
- * **openapi:** bad yargs options for enableDate ([cc799cb](https://github.com/touchifyapp/spec2ts/commit/cc799cb14600f5a5388a825932622251ed1df19c))
66
-
67
-
68
-
69
-
70
-
71
- # [2.0.0-beta.2](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.1...@spec2ts/openapi-client@2.0.0-beta.2) (2020-11-29)
72
-
73
-
74
- ### Features
75
-
76
- * **openapi-client:** add support for new lax date style ([73ac242](https://github.com/touchifyapp/spec2ts/commit/73ac2428cf7195817cc66c41a9e18fa6e9a7abee))
77
-
78
-
79
-
80
-
81
-
82
- # [2.0.0-beta.1](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@2.0.0-beta.0...@spec2ts/openapi-client@2.0.0-beta.1) (2020-11-16)
83
-
84
-
85
- ### Bug Fixes
86
-
87
- * **openapi-client:** improve types for TypeScript v4 ([7927e7b](https://github.com/touchifyapp/spec2ts/commit/7927e7ba48f5abf03f0a51972213f9034cf5f09d))
88
-
89
-
90
-
91
-
92
-
93
- # [2.0.0-beta.0](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.4.3...@spec2ts/openapi-client@2.0.0-beta.0) (2020-11-13)
94
-
95
-
96
- ### Features
97
-
98
- * **global:** upgrade typescript 4 ([#16](https://github.com/touchifyapp/spec2ts/issues/16)) ([fcd82be](https://github.com/touchifyapp/spec2ts/commit/fcd82be93be3986a2f723680f1c52818eb7ba1bc))
99
-
100
-
101
- ### BREAKING CHANGES
102
-
103
- * **global:** use typescript v4
104
- * **global:** updates are now immutable
105
-
106
-
107
-
108
-
109
-
110
- ## [1.4.3](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.4.2...@spec2ts/openapi-client@1.4.3) (2020-10-26)
111
-
112
- **Note:** Version bump only for package @spec2ts/openapi-client
113
-
114
-
115
-
116
-
117
-
118
- ## [1.4.2](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.4.1...@spec2ts/openapi-client@1.4.2) (2020-10-26)
119
-
120
- **Note:** Version bump only for package @spec2ts/openapi-client
121
-
122
-
123
-
124
-
125
-
126
- ## [1.4.1](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.4.0...@spec2ts/openapi-client@1.4.1) (2020-10-06)
127
-
128
-
129
- ### Bug Fixes
130
-
131
- * **openapi-client:** various serialization misbehaviors ([#6](https://github.com/touchifyapp/spec2ts/issues/6)) ([02b320f](https://github.com/touchifyapp/spec2ts/commit/02b320f2c55674fd26ad691137753baa1cee82af))
132
-
133
-
134
-
135
-
136
-
137
- # [1.4.0](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.3.0...@spec2ts/openapi-client@1.4.0) (2020-07-08)
138
-
139
-
140
- ### Features
141
-
142
- * **openapi-client:** allow to separtes types from client ([6c0e246](https://github.com/touchifyapp/spec2ts/commit/6c0e2462642217229c439d9002db90d6b2517166))
143
-
144
-
145
-
146
-
147
-
148
- # [1.3.0](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.2.3...@spec2ts/openapi-client@1.3.0) (2020-06-01)
149
-
150
-
151
- ### Features
152
-
153
- * **openapi-client:** add cli options ([9dbd5c7](https://github.com/touchifyapp/spec2ts/commit/9dbd5c769b828bf1c1366fab4bcf58214c805270))
154
-
155
-
156
-
157
-
158
-
159
- ## [1.2.3](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.2.2...@spec2ts/openapi-client@1.2.3) (2020-05-27)
160
-
161
- **Note:** Version bump only for package @spec2ts/openapi-client
162
-
163
-
164
-
165
-
166
-
167
- ## [1.2.2](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.2.1...@spec2ts/openapi-client@1.2.2) (2020-05-24)
168
-
169
-
170
- ### Bug Fixes
171
-
172
- * **openapi-client:** fix missing @types/node with custom fetch ([a9696ef](https://github.com/touchifyapp/spec2ts/commit/a9696ef7222d1961bfb657d53082cafd89b7cc2e))
173
-
174
-
175
-
176
-
177
-
178
- ## [1.2.1](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.2.0...@spec2ts/openapi-client@1.2.1) (2020-05-24)
179
-
180
-
181
- ### Bug Fixes
182
-
183
- * **openapi-client:** fix default build script ([e9c9733](https://github.com/touchifyapp/spec2ts/commit/e9c973303f484e4be314ecab41480decd1f5c26d))
184
-
185
-
186
-
187
-
188
-
189
- # [1.2.0](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.1.2...@spec2ts/openapi-client@1.2.0) (2020-05-24)
190
-
191
-
192
- ### Bug Fixes
193
-
194
- * **openapi-client:** improve custom fetch implementation support ([cf7a434](https://github.com/touchifyapp/spec2ts/commit/cf7a434327dda5c7ee959f8084f251d42fbe00b3))
195
-
196
-
197
- ### Features
198
-
199
- * **cli:** add default banner ([b0945e0](https://github.com/touchifyapp/spec2ts/commit/b0945e08b2c1da4dc494dca1890d491768a13e60))
200
-
201
-
202
-
203
-
204
-
205
- ## [1.1.2](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.1.1...@spec2ts/openapi-client@1.1.2) (2020-05-22)
206
-
207
-
208
- ### Bug Fixes
209
-
210
- * **openapi-client:** use explode by default for form style ([d09909d](https://github.com/touchifyapp/spec2ts/commit/d09909db2db8fb136b113e5f921f90cccb31a81c))
211
-
212
-
213
-
214
-
215
-
216
- ## [1.1.1](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.1.0...@spec2ts/openapi-client@1.1.1) (2020-05-18)
217
-
218
- **Note:** Version bump only for package @spec2ts/openapi-client
219
-
220
-
221
-
222
-
223
-
224
- # [1.1.0](https://github.com/touchifyapp/spec2ts/compare/@spec2ts/openapi-client@1.0.0...@spec2ts/openapi-client@1.1.0) (2020-05-18)
225
-
226
-
227
- ### Features
228
-
229
- * **oapi-client:** add package.json generation ([c89ebab](https://github.com/touchifyapp/spec2ts/commit/c89ebab8d68961797aee47799be21b8371a10fb6))
230
-
231
-
232
-
233
-
234
-
235
- # 1.0.0 (2020-05-18)
236
-
237
-
238
- ### Features
239
-
240
- * **oapi-client:** add openapi-client generator ([9c83cf8](https://github.com/touchifyapp/spec2ts/commit/9c83cf888eb1ad873beba17a3a11de1bc84db723))
241
-
242
-
243
- ### BREAKING CHANGES
244
-
245
- * **oapi-client:** force V1
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import "../cli";