Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple jsonschema to individual packages #1594

Open
tomasbjerre opened this issue Mar 24, 2024 · 0 comments
Open

Multiple jsonschema to individual packages #1594

tomasbjerre opened this issue Mar 24, 2024 · 0 comments

Comments

@tomasbjerre
Copy link

I have several schemas and I want each of them to be generated into individual packages.

This code will not work (because the last element in the list will overwrite any previous config...), but perhaps shows what I want to do:

apply plugin: 'jsonschema2pojo'

[
  [
    removeOldOutput: true,
    from: "${rootDir}/src/main/resources/json/sarif-schema.json",
    to: "se.bjurr.violations.lib.model.generated.sarif"
  ],
  [
    removeOldOutput: false,
    from: "${rootDir}/src/main/resources/json/coverity-schema.json",
    to: "se.bjurr.violations.lib.model.generated.coverity"
  ]
].each { codeGen ->
  logger.lifecycle("Generating ${codeGen.from} to ${codeGen.to}")

  jsonSchema2Pojo {
    source = files(codeGen.from)
    targetDirectory = file("src/gen/java")
    targetPackage = codeGen.to
    generateBuilders = true
    annotationStyle = 'none'
    includeGeneratedAnnotation = false
    removeOldOutput = codeGen.removeOldOutput
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant