@@ -299,10 +299,20 @@ Regardless If your Angular project was generated or is managed by
299
299
[ Angular CLI] ( https://cli.angular.io/ ) , or you have started your project with
300
300
some other seed (for example, using [ webpack] ( https://webpack.js.org/ )
301
301
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 ` :
303
315
304
- To do so, create the ` ng-openapi-gen.json ` configuration file and add the
305
- following ` scripts ` to your ` package.json ` :
306
316
``` json
307
317
{
308
318
"scripts" : {
@@ -312,6 +322,7 @@ following `scripts` to your `package.json`:
312
322
}
313
323
}
314
324
```
325
+
315
326
This way whenever you run ` npm start ` or ` npm run build ` , the API classes
316
327
will be generated before actually serving / building your application.
317
328
0 commit comments