decided
When generating only from one spec (either generator), which is probably the most common use case, when doing this manually, the resulting folder structure is <outputDir>/serviceDir
, which in turn is unexpected.
The name of the generator command is: generate-X-client
indicating that only one client will be generated.
- Different behavior if only one specification is found vs. multiple.
For one specification, put client directly into
<outputDir>
, for multiple make subdirectories. generate-openapi-client batch -i <inputFile> -o <outputDir>
Generate only the first matched input file found by default. Show a log message in case there are multiple inputs found, that batch argument is required to nest the APIs.generate-openapi-client -i <inputFile> -o <outputDir> --flat
Flatten the directory to be<outputDir>
. Throw an error if input is a directory (with multiple files).- Keep it as is. (decided)
- Rename the client:
openapi-generator
(decided)sap-cloud-sdk-openapi-generator
The given outputDir
is the actual output directory.
Depending on the decided option, the behavior might be considered inconsistent by default.
The option naming is slightly inconsistent and quite long at times. Some of the defaults might lead to many files being generated and transpiled by default - potentially more than necessary. We should discuss the details of those defaults and make a conscious decision on whether to keep or adjust them.
Current Name, Aliases | Future Name, Aliases | Current Behavior | Future Behavior |
---|---|---|---|
--inputDir , -i (required) |
--input , -i (required) |
Input directory/file | same |
--outputDir , -o (required) |
--outputDir , -o (required) |
Output directory | same |
--clearOutputDir |
--clearOutputDir |
Delete all files in output directory | same |
--generateJs |
--transpile , -t |
Transpiles, default true | Transpiles, default false. If set if tsconfig is enabled with default (unless configured). This should be explicitly stated in the documentation. |
--generatePackageJson |
--[no]-packageJson |
Writes a default package.json, default true. | Writes a default package.json, default false. Optionally in the future: Writes a custom package.json if passed. Keep boolean for now. |
--serviceMapping |
--optionsPerService |
Considers a per service configuration file. Shows a warning if none is given (differs from OData behavior). | Only generates a per service configuration, if a file path is provided. No warning if it is not provided. If provided, packageName and directoryName will be generated, but are not required to be set. * |
--tsconfig |
--tsconfig |
tsconfig.json file to overwrite the default "tsconfig.json". | Writes a custom tsconfig.json if passed. Document that this should be used in combination with transpile . |
--include |
--include |
Copy additional files, identified by glob. | same |
Options in OData, but not (yet in OpenAPI) generator | |||
--forceOverwrite |
--overwrite |
Overwrite files even it they exist, default false. | same |
--generateTypedocJson |
--typedocJson |
Writes a default typedoc.json, default true. | Remove/deprecate, use include instead. |
Currently hidden options | |||
--writeReadme |
--readme |
Writes a default README.md, default false. | same |
--packageVersion |
--packageVersion |
Version in package.json, default is 1.0.0 . |
Version in package.json, default is 1.0.0 . Hide it. |
New options | |||
- | --skipValidation |
Duplicate names are renamed by default. | Duplicate names throw an error by default. Disable validation to rename duplicates. |
- | --verbose |
Logs everything that happens during generation by default. | Log only success / error per service by default. Enable verbosity through this flag. |
- | --version , -v |
- | Prints the version of the generator. |
Naming is clearer, shorter and consistent. Only minor implementation needed for a first version.