joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

Excluding files #1639

Closed marceloverdijk closed 1 month ago

marceloverdijk commented 1 month ago

I'm using jsonschema2pojo in a Kotlin with the following configuration:

jsonSchema2Pojo {
    sourceFiles = files("$projectDir/../src/schema/current/")
    targetDirectory = file("build/generated-sources/jsonschema2pojo")
    removeOldOutput = true
    ..

This src/schema/current folder contains sub-folders and jsonschema2pojo nicely creates sub-packages for that. Until now this setup was working perfectly, but now I have some non json schema files that are added to src/schema/current and because these file are non json schema's the jsonschema2pojo task fails as it does not recognize them.

Is there a way to exclude certain folders/files?

marceloverdijk commented 1 month ago

fileFilter = FileFilter { file -> file.name.endsWith(".json") } did the trick.