@povio/openapi-codegen-cli 2.0.8-rc.26 → 2.0.8-rc.27

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/README.md CHANGED
@@ -76,6 +76,7 @@ yarn openapi-codegen generate --config my-config.ts
76
76
  --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true)
77
77
  --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common')
78
78
 
79
+ --includeTags Comma-separated list of tags to include in generation
79
80
  --excludeTags Comma-separated list of tags to exclude from generation
80
81
  --excludePathRegex Exclude operations whose paths match the given regular expression
81
82
  --excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true)
@@ -115,6 +116,7 @@ yarn openapi-codegen generate --config my-config.ts
115
116
  --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true)
116
117
  --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common')
117
118
 
119
+ --includeTags Comma-separated list of tags to include in generation
118
120
  --excludeTags Comma-separated list of tags to exclude from generation
119
121
  --excludePathRegex Exclude operations whose paths match the given regular expression
120
122
  --excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true)
@@ -1,4 +1,4 @@
1
- import { t as GenerateOptions } from "./options-PQDrYdAn.mjs";
1
+ import { t as GenerateOptions } from "./options-DmeJPSRO.mjs";
2
2
 
3
3
  //#region src/generators/types/config.d.ts
4
4
  type OpenAPICodegenConfig = Partial<GenerateOptions>;
@@ -1,12 +1,13 @@
1
- import { a as deepMerge, p as DEFAULT_GENERATE_OPTIONS, r as writeGenerateFileData, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-C7btBlMx.mjs";
1
+ import { a as deepMerge, p as DEFAULT_GENERATE_OPTIONS, r as writeGenerateFileData, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-BOySFp9b.mjs";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import SwaggerParser from "@apidevtools/swagger-parser";
5
5
 
6
6
  //#region src/generators/core/resolveConfig.ts
7
- function resolveConfig({ fileConfig = {}, params: { excludeTags, inlineEndpointsExcludeModules, ...options } }) {
7
+ function resolveConfig({ fileConfig = {}, params: { includeTags, excludeTags, inlineEndpointsExcludeModules, ...options } }) {
8
8
  const resolvedConfig = deepMerge(DEFAULT_GENERATE_OPTIONS, fileConfig ?? {}, {
9
9
  ...options,
10
+ includeTags: includeTags?.split(","),
10
11
  excludeTags: excludeTags?.split(","),
11
12
  inlineEndpointsExcludeModules: inlineEndpointsExcludeModules?.split(",")
12
13
  });
@@ -180,8 +180,10 @@ function getOperationTag(operation, options) {
180
180
  function getEndpointTag(endpoint, options) {
181
181
  return formatTag((options.splitByTags ? endpoint.tags?.[0] : options.defaultTag) ?? options.defaultTag);
182
182
  }
183
- function isTagExcluded(tag, options) {
184
- return options.excludeTags.some((excludeTag) => excludeTag.toLowerCase() === tag.toLowerCase());
183
+ function isTagIncluded(tag, options) {
184
+ if (options.includeTags.some((includeTag) => includeTag.toLowerCase() === tag.toLowerCase())) return true;
185
+ if (options.excludeTags.some((excludeTag) => excludeTag.toLowerCase() === tag.toLowerCase())) return false;
186
+ return options.includeTags.length === 0;
185
187
  }
186
188
  function shouldInlineEndpointsForTag(tag, options) {
187
189
  if (!options.inlineEndpoints) return false;
@@ -594,6 +596,7 @@ const DEFAULT_GENERATE_OPTIONS = {
594
596
  incremental: true,
595
597
  splitByTags: true,
596
598
  defaultTag: "Common",
599
+ includeTags: [],
597
600
  excludeTags: [],
598
601
  excludePathRegex: "",
599
602
  excludeRedundantZodSchemas: true,
@@ -2295,8 +2298,8 @@ const RESERVED_WORDS = [
2295
2298
  //#region src/generators/utils/operation.utils.ts
2296
2299
  function isOperationExcluded(operation, options) {
2297
2300
  const isDeprecated = operation.deprecated && !options.withDeprecatedEndpoints;
2298
- const isExcluded = isTagExcluded(getOperationTag(operation, options), options);
2299
- return isDeprecated || isExcluded;
2301
+ const isIncluded = isTagIncluded(getOperationTag(operation, options), options);
2302
+ return isDeprecated || !isIncluded;
2300
2303
  }
2301
2304
  function getOperationName({ path, method, operation, options, tag, keepOperationTag, keepOperationPrefix }) {
2302
2305
  const pathOperationName = `${method}${pathToVariableName(path)}`;
@@ -1,4 +1,4 @@
1
- import { n as GenerateFileData, t as GenerateOptions } from "./options-PQDrYdAn.mjs";
1
+ import { n as GenerateFileData, t as GenerateOptions } from "./options-DmeJPSRO.mjs";
2
2
  import { OpenAPIV3 } from "openapi-types";
3
3
 
4
4
  //#region src/generators/types/metadata.d.ts
@@ -1,4 +1,4 @@
1
- import { _ as isMediaTypeAllowed, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, h as GenerateType, i as getDataFromOpenAPIDoc, l as getTsTypeBase, m as getNamespaceName, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isParamMediaTypeAllowed, y as invalidVariableNameCharactersToCamel } from "./generateCodeFromOpenAPIDoc-C7btBlMx.mjs";
1
+ import { _ as isMediaTypeAllowed, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, h as GenerateType, i as getDataFromOpenAPIDoc, l as getTsTypeBase, m as getNamespaceName, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isParamMediaTypeAllowed, y as invalidVariableNameCharactersToCamel } from "./generateCodeFromOpenAPIDoc-BOySFp9b.mjs";
2
2
  import SwaggerParser from "@apidevtools/swagger-parser";
3
3
 
4
4
  //#region src/generators/core/getMetadataFromOpenAPIDoc.ts
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as GeneralErrorCodes, i as ErrorHandlerOptions, n as ErrorEntry, o as SharedErrorHandler, r as ErrorHandler, t as ApplicationException } from "./error-handling-CXeVTk1T.mjs";
2
- import "./options-PQDrYdAn.mjs";
3
- import { t as OpenAPICodegenConfig } from "./config-HbwoMgWr.mjs";
2
+ import "./options-DmeJPSRO.mjs";
3
+ import { t as OpenAPICodegenConfig } from "./config-BRQts1Ob.mjs";
4
4
  import { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, CreateAxiosDefaults } from "axios";
5
5
  import { z } from "zod";
6
6
  import "i18next";
@@ -76,6 +76,7 @@ interface BaseGenerateOptions {
76
76
  incremental?: boolean;
77
77
  splitByTags: boolean;
78
78
  defaultTag: string;
79
+ includeTags: string[];
79
80
  excludeTags: string[];
80
81
  excludePathRegex: string;
81
82
  excludeRedundantZodSchemas: boolean;
package/dist/sh.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-C7btBlMx.mjs";
3
- import { n as resolveConfig, t as runGenerate } from "./generate.runner-DAUfcVtT.mjs";
2
+ import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-BOySFp9b.mjs";
3
+ import { n as resolveConfig, t as runGenerate } from "./generate.runner-u9OgfXxv.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
@@ -39,7 +39,7 @@ function logBanner(message) {
39
39
  * Fetch the version from package.json
40
40
  */
41
41
  function getVersion() {
42
- return "2.0.8-rc.26";
42
+ return "2.0.8-rc.27";
43
43
  }
44
44
 
45
45
  //#endregion
@@ -187,7 +187,7 @@ function pathToFileURL(filePath) {
187
187
 
188
188
  //#endregion
189
189
  //#region src/commands/check.ts
190
- async function check({ verbose, config: configParam, excludeTags: _excludeTagsParam, ...params }) {
190
+ async function check({ verbose, config: configParam, includeTags: _includeTagsParam, excludeTags: _excludeTagsParam, ...params }) {
191
191
  const start = Date.now();
192
192
  if (verbose) logInfo("Resolving config...");
193
193
  const config = resolveConfig({
@@ -224,6 +224,7 @@ var CheckOptions = class {
224
224
  input;
225
225
  splitByTags;
226
226
  defaultTag;
227
+ includeTags;
227
228
  excludeTags;
228
229
  excludePathRegex;
229
230
  excludeRedundantZodSchemas;
@@ -236,6 +237,7 @@ __decorate([YargOption({
236
237
  type: "boolean"
237
238
  }), __decorateMetadata("design:type", Boolean)], CheckOptions.prototype, "splitByTags", void 0);
238
239
  __decorate([YargOption({ envAlias: "defaultTag" }), __decorateMetadata("design:type", String)], CheckOptions.prototype, "defaultTag", void 0);
240
+ __decorate([YargOption({ envAlias: "includeTags" }), __decorateMetadata("design:type", String)], CheckOptions.prototype, "includeTags", void 0);
239
241
  __decorate([YargOption({ envAlias: "excludeTags" }), __decorateMetadata("design:type", String)], CheckOptions.prototype, "excludeTags", void 0);
240
242
  __decorate([YargOption({ envAlias: "excludePathRegex" }), __decorateMetadata("design:type", String)], CheckOptions.prototype, "excludePathRegex", void 0);
241
243
  __decorate([YargOption({
@@ -303,6 +305,7 @@ var GenerateOptions = class {
303
305
  tsPath;
304
306
  splitByTags;
305
307
  defaultTag;
308
+ includeTags;
306
309
  excludeTags;
307
310
  excludePathRegex;
308
311
  excludeRedundantZodSchemas;
@@ -343,6 +346,7 @@ __decorate([YargOption({
343
346
  type: "boolean"
344
347
  }), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "splitByTags", void 0);
345
348
  __decorate([YargOption({ envAlias: "defaultTag" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "defaultTag", void 0);
349
+ __decorate([YargOption({ envAlias: "includeTags" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "includeTags", void 0);
346
350
  __decorate([YargOption({ envAlias: "excludeTags" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "excludeTags", void 0);
347
351
  __decorate([YargOption({ envAlias: "excludePathRegex" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "excludePathRegex", void 0);
348
352
  __decorate([YargOption({
package/dist/vite.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { r as GenerateFileFormatter } from "./options-PQDrYdAn.mjs";
2
- import { t as OpenAPICodegenConfig } from "./config-HbwoMgWr.mjs";
1
+ import { r as GenerateFileFormatter } from "./options-DmeJPSRO.mjs";
2
+ import { t as OpenAPICodegenConfig } from "./config-BRQts1Ob.mjs";
3
3
  import { Plugin } from "vite";
4
4
 
5
5
  //#region src/vite/openapi-codegen.plugin.d.ts
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { x as Profiler } from "./generateCodeFromOpenAPIDoc-C7btBlMx.mjs";
2
- import { t as runGenerate } from "./generate.runner-DAUfcVtT.mjs";
1
+ import { x as Profiler } from "./generateCodeFromOpenAPIDoc-BOySFp9b.mjs";
2
+ import { t as runGenerate } from "./generate.runner-u9OgfXxv.mjs";
3
3
  import path from "path";
4
4
 
5
5
  //#region src/vite/openapi-codegen.plugin.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "2.0.8-rc.26",
3
+ "version": "2.0.8-rc.27",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",