ts-openapi-codegen 0.1.21 → 0.1.22

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.
Files changed (2) hide show
  1. package/bin/index.js +3 -7
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -16,8 +16,8 @@ const params = program
16
16
  .option('-i, --input <value>', 'OpenAPI specification, can be a path, url or string content (required)')
17
17
  .option('-o, --output <value>', 'Output directory (required)')
18
18
  .option('-c, --client <value>', 'HTTP client to generate [fetch, xhr, node]', 'fetch')
19
- .option('--useOptions', 'Use options instead of arguments')
20
- .option('--useUnionTypes', 'Use union types instead of enums')
19
+ .option('--useOptions <value>', 'Use options instead of arguments', false)
20
+ .option('--useUnionTypes <value>', 'Use union types instead of enums', false)
21
21
  .option('--exportCore <value>', 'Write core files to disk', true)
22
22
  .option('--exportServices <value>', 'Write services to disk', true)
23
23
  .option('--exportModels <value>', 'Write models to disk', true)
@@ -28,10 +28,6 @@ const params = program
28
28
  .opts();
29
29
 
30
30
  function isValidJson(value) {
31
- if (!!value && typeof value !== 'string') {
32
- return false;
33
- }
34
-
35
31
  try {
36
32
  JSON.parse(value);
37
33
  return true;
@@ -70,7 +66,7 @@ if (OpenAPI) {
70
66
  const fs = require('fs');
71
67
  const configFile = path.resolve(process.cwd(), 'openapi.config.json');
72
68
  if (fs.existsSync(configFile)) {
73
- const dataString = fs.readFileSync(configFile);
69
+ const dataString = fs.readFileSync(configFile, { encoding: `UTF-8` });
74
70
  const configs = isValidJson(dataString) ? JSON.parse(dataString) : [];
75
71
  if (params.clean) {
76
72
  configs.forEach(config => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-openapi-codegen",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
5
5
  "author": "Alexey Zverev",
6
6
  "homepage": "https://github.com/ozonophore/openapi-codegen.git",