Skip to content

Conversation

andriy-dmytruk
Copy link
Collaborator

@andriy-dmytruk andriy-dmytruk commented Apr 1, 2025

Switch JSON schema to generate Maven and Gradle configurations based on micronaut-build-plugin-sourcegen.

The generated plugins will:

  • Have the same properties defined
  • Have the javadoc copied as defined in this repo
  • Add the generated files as build sources

This would simplify support, as additional properties would require no manual changes in the plugins. Some properties would already be added in this PR: #163.

Current support

Maven Gradle Plugingen
inputURL inputUrl inputURL
inputFile inputFile inputFile
inputDirectory inputDirectory inputDirectory
language default=JAVA lang default=JAVA language default=JAVA
outputDirectory default="${project.build.directory}/generated-sources/jsonschema" outputDirectory outputDirectory
outputPackageName default=io.micronaut.jsonschema outputPackageName outputPackageName default=io.micronaut.jsonschema
outputFileName outputFileName outputFileName
acceptedUrlPatterns acceptedUrlPatterns acceptedUrlPatterns
enabled default=false enabed default=true enabled default=false/true

Copy link

sonarqubecloud bot commented Apr 1, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

@PluginTaskParameter
List<String> acceptedUrlPatterns,
@PluginTaskParameter(directory = true, output = OutputType.CUSTOM, required = true)
File outputDirectory,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused by the outputDirectory here.
In the previous version, it was not required and its default value was generated/jsonschema. It is also not used in the guide examples and docs etc. And we added the language source directories after the given outputDirectory in the plugins. So the final address used to be: outputDirectory + languageDir + outputPackageName + outputFileName.
But here, we are setting the outputDirectory as the languageDir. Is this what is desired?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added the different language folders, so that is more explicit where the files are generated.

The folders have to be added to the classpath in different ways (like groovy to the groovy source sets if groovy plugin exists).

This is a change from the previous behavior when output directory was overridden, but also means that the directory is added to the appropriate classpath.

@andriy-dmytruk andriy-dmytruk force-pushed the andriy/build-plugin-sourcegen branch from 2b6426d to f37e37f Compare April 22, 2025 18:31
@graemerocher graemerocher added the type: enhancement New feature or request label Oct 7, 2025
@sdelamo sdelamo removed this from 4.10.0 Release Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants