swaggie 1.8.2 → 1.8.3

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
@@ -72,21 +72,23 @@ swaggie -s https://petstore3.swagger.io/api/v3/openapi.json -o ./client/petstore
72
72
  **Available options:**
73
73
 
74
74
  ```
75
- -V, --version Output the version number
76
- -c, --config <path> Path to a JSON configuration file
77
- -s, --src <url|path> URL or file path to the OpenAPI spec
78
- -o, --out <filePath> Output file path (omit to print to stdout)
79
- -b, --baseUrl <string> Default base URL for the generated client (default: "")
80
- -t, --template <string> Template to use for code generation (default: "axios")
81
- -m, --mode <mode> Generation mode: "full" or "schemas" (default: "full")
82
- -d, --schemaStyle <style> Schema object style: "interface" or "type" (default: "interface")
75
+ -V, --version Output the version number
76
+ -c, --config <path> Path to a JSON configuration file
77
+ -s, --src <url|path> URL or file path to the OpenAPI spec
78
+ -o, --out <filePath> Output file path (omit to print to stdout)
79
+ -b, --baseUrl <string> Default base URL for the generated client (default: "")
80
+ -t, --template <string> Template to use for code generation (default: "axios")
81
+ -m, --mode <mode> Generation mode: "full" or "schemas" (default: "full")
82
+ -d, --schemaStyle <style> Schema object style: "interface" or "type" (default: "interface")
83
83
  --enumStyle <style> Enum style for plain string enums: "union" or "enum" (default: "union")
84
- --preferAny Use "any" instead of "unknown" for untyped values (default: false)
85
- --skipDeprecated Exclude deprecated operations from the output (default: false)
86
- --servicePrefix Prefix for service names useful when generating multiple APIs
87
- --allowDots Use dot notation to serialize nested object query params
88
- --arrayFormat How arrays are serialized: "indices", "repeat", or "brackets"
89
- -h, --help Show help
84
+ --dateFormat <format> Date handling in schemas: "Date" or "string"
85
+ --nullables <strategy> Nullable handling: "include", "nullableAsOptional", or "ignore"
86
+ --preferAny Use "any" instead of "unknown" for untyped values (default: false)
87
+ --skipDeprecated Exclude deprecated operations from the output (default: false)
88
+ --servicePrefix Prefix for service names useful when generating multiple APIs
89
+ --allowDots Use dot notation to serialize nested object query params
90
+ --arrayFormat How arrays are serialized: "indices", "repeat", or "brackets"
91
+ -h, --help Show help
90
92
  ```
91
93
 
92
94
  ### Formatting the Output
package/dist/cli.js CHANGED
@@ -27,6 +27,14 @@ const enumStyleOption = new (0, _commander.Option)(
27
27
  '--enumStyle <style>',
28
28
  'Enum declaration style for plain string enums'
29
29
  ).choices(['union', 'enum']);
30
+ const dateFormatOption = new (0, _commander.Option)(
31
+ '--dateFormat <format>',
32
+ 'How date fields are emitted in generated types'
33
+ ).choices(['Date', 'string']);
34
+ const nullableStrategyOption = new (0, _commander.Option)(
35
+ '--nullables <strategy>',
36
+ "Controls how OpenAPI 'nullable' is translated into TypeScript types"
37
+ ).choices(['include', 'nullableAsOptional', 'ignore']);
30
38
 
31
39
  const program = new (0, _commander.Command)();
32
40
  program
@@ -69,7 +77,9 @@ program
69
77
  .addOption(arrayFormatOption)
70
78
  .addOption(modeOption)
71
79
  .addOption(schemaStyleOption)
72
- .addOption(enumStyleOption);
80
+ .addOption(enumStyleOption)
81
+ .addOption(dateFormatOption)
82
+ .addOption(nullableStrategyOption);
73
83
 
74
84
  program.parse(process.argv);
75
85
 
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ function readFile(filePath) {
84
84
  mode,
85
85
  schemaStyle,
86
86
  enumStyle,
87
+ nullables,
87
88
  template,
88
89
  queryParamsSerialization = {},
89
90
  ...rest
@@ -101,7 +102,7 @@ function readFile(filePath) {
101
102
  ...rest,
102
103
  template: _nullishCoalesce(template, () => ( _swagger.APP_DEFAULTS.template)),
103
104
  servicePrefix: _nullishCoalesce(rest.servicePrefix, () => ( _swagger.APP_DEFAULTS.servicePrefix)),
104
- nullableStrategy: _nullishCoalesce(rest.nullableStrategy, () => ( _swagger.APP_DEFAULTS.nullableStrategy)),
105
+ nullableStrategy: _nullishCoalesce(_nullishCoalesce(nullables, () => ( rest.nullableStrategy)), () => ( _swagger.APP_DEFAULTS.nullableStrategy)),
105
106
  generationMode: _nullishCoalesce(_nullishCoalesce(mode, () => ( rest.generationMode)), () => ( _swagger.APP_DEFAULTS.generationMode)),
106
107
  schemaDeclarationStyle:
107
108
  _nullishCoalesce(_nullishCoalesce(schemaStyle, () => ( rest.schemaDeclarationStyle)), () => ( _swagger.APP_DEFAULTS.schemaDeclarationStyle)),
package/dist/types.d.ts CHANGED
@@ -49,6 +49,7 @@ export interface CliOptions extends FullAppOptions {
49
49
  mode?: GenerationMode;
50
50
  schemaStyle?: SchemaDeclarationStyle;
51
51
  enumStyle?: EnumDeclarationStyle;
52
+ nullables?: NullableStrategy;
52
53
  }
53
54
  export interface FullAppOptions extends ClientOptions {
54
55
  /** Path to the configuration file that contains actual config to be used */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swaggie",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "Generate a fully typed TypeScript API client from your OpenAPI 3 spec",
5
5
  "author": {
6
6
  "name": "Piotr Dabrowski",