openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] Harden `new.sh` to create directory structures if they don't already exist

Open slifty opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

I'm using the new.sh script to create a new custom generator, but I'm doing so outside of the context of the openapi-generator repository. The script breaks in a few locations since it it assumes that a directory structure already exists.

I've gone through my copy and added a series of mkdir -p commands before various echo and cat commands, but wanted to suggest that these lines get added to the script for other devs who might want to create custom templates without the baggage of an entire fork.

Describe the solution you'd like

Add in mkdir -p commands to new.sh before writing to a file that assumes a given directory exists.

Describe alternatives you've considered

The alternatives are:

  1. Bespoke manual editing of new.sh
  2. Running it in the context of the openapi-generator repository.

Additional context

I'd be happy to open a PR for this if it's acceptable.

slifty avatar May 21 '24 16:05 slifty

thanks for the feedback

can you please open a PR to start with and we will review accordingly?

wing328 avatar May 23 '24 08:05 wing328