You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using selective generation, _only_ the templates needed for the specific generation will be used.
410
410
411
+
### Ignore file format
412
+
413
+
Swagger codegen supports a `.swagger-codegen-ignore` file, similar to `.gitignore` or `.dockerignore` you're probably already familiar with.
414
+
415
+
The ignore file allows for better control over overwriting existing files than the `--skip-overwrite` flag. With the ignore file, you can specify individual files or directories can be ignored. This can be useful, for example if you only want a subset of the generated code.
416
+
417
+
Examples:
418
+
419
+
```
420
+
# Swagger Codegen Ignore
421
+
# Lines beginning with a # are comments
422
+
423
+
# This should match build.sh located anywhere.
424
+
build.sh
425
+
426
+
# Matches build.sh in the root
427
+
/build.sh
428
+
429
+
# Exclude all recursively
430
+
docs/**
431
+
432
+
# Explicitly allow files excluded by other rules
433
+
!docs/UserApi.md
434
+
435
+
# Recursively exclude directories named Api
436
+
# You can't negate files below this directory.
437
+
src/**/Api/
438
+
439
+
# When this file is nested under /Api (excluded above),
440
+
# this rule is ignored because parent directory is excluded by previous rule.
441
+
!src/**/PetApiTests.cs
442
+
443
+
# Exclude a single, nested file explicitly
444
+
src/IO.Swagger.Test/Model/AnimalFarmTests.cs
445
+
```
446
+
447
+
The `.swagger-codegen-ignore` file must exist in the root of the output directory.
448
+
411
449
### Customizing the generator
412
450
413
451
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
@@ -814,6 +852,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
Copy file name to clipboardExpand all lines: modules/swagger-codegen-maven-plugin/README.md
+39-1Lines changed: 39 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,44 @@ mvn clean compile
48
48
-`configOptions` - a map of language-specific parameters (see below)
49
49
-`configHelp` - dumps the configuration help for the specified library (generates no sources)
50
50
51
+
### Custom Generator
52
+
53
+
Specifying a custom generator is a bit different. It doesn't support the classpath:/ syntax, but it does support the fully qualified name of the package. You can also specify your custom templates, which also get pulled in. Notice the dependency on a project, in the plugin scope. That would be your generator/template jar.
0 commit comments