Skip to content

Commit 41bca7c

Browse files
author
Luis Fernando Planella Gonzalez
committed
Add a paragraph to not commit generated code
1 parent 9a8a00a commit 41bca7c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,20 @@ Regardless If your Angular project was generated or is managed by
299299
[Angular CLI](https://cli.angular.io/), or you have started your project with
300300
some other seed (for example, using [webpack](https://webpack.js.org/)
301301
directly), you can setup a script to make sure the generated API classes are
302-
consistent with the swagger descriptor.
302+
consistent with the OpenAPI descriptor.
303+
304+
It is not a good practice to have generated committed to the source control
305+
system (such as git). The only exception, is for projects using a third party
306+
API definition that never changes, in which ng-openapi-gen is expected to run
307+
only once. To ignore the generator output folder to in GIT, assuming the
308+
default output folder `src/app/api`, create the `src/app/.gitignore` file,
309+
with a line being `api`.
310+
311+
Setting up a script will make sure that whenever your project is started or
312+
built, the generated files are consistent with the API definition. To do so,
313+
create the `ng-openapi-gen.json` configuration file and add the following
314+
`scripts` to your `package.json`:
303315

304-
To do so, create the `ng-openapi-gen.json` configuration file and add the
305-
following `scripts` to your `package.json`:
306316
```json
307317
{
308318
"scripts": {
@@ -312,6 +322,7 @@ following `scripts` to your `package.json`:
312322
}
313323
}
314324
```
325+
315326
This way whenever you run `npm start` or `npm run build`, the API classes
316327
will be generated before actually serving / building your application.
317328

0 commit comments

Comments
 (0)