Class Names Glob Patterns (original) (raw)

Typescript-generator input classes can be specified using classPatterns parameter which is a list of glob patterns. Any class whose name matches any of the specified patterns will be included unless it is explicitly excluded. This parameter can be combined with other input parameters (classes and classesFromJaxrsApplication).

Note: class dependencies will be also included even if they do not match any pattern (for example if class A has a propery of type B then B will be also included regardless of its name). This transitive mechanism applies to all input parameters.

Classes can be excluded one by one by using excludeClasses parameter. It is also possible to exclude multiple classes at once by using excludeClassPatterns parameter.

Globbing syntax

Class name glob patterns support two wildcards.

Example patterns

Maven example

cz.habarta.typescript-generator typescript-generator-maven-plugin 1.7.x generate generate process-classes jackson2 cz.habarta.example.* cz.habarta.example.data.** cz.habarta.example.rest.* cz.habarta.example.Application target/rest.d.ts global

JAX-RS Application

If you have JAX-RS Application it is recommended to specify input classes using classesFromJaxrsApplication parameter instead of using globbing. For more information see JAX RS Application.

Tip: as mentioned before classes are included transitively. But sometimes whole chain of classes is discovered unintentionally so it is practical to use excludeClasses parameter to exclude root of this chain or tree. For example if class A which is explicitly included has a property of type B, class B has C and class C has Dit is sufficient to exclude class B to exclude B, C and D and process class A only.