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

OpenAPI: openapi-model-generator-maven-plugin to generate Java types from OpenAPI schemas #6135

Closed
manusa opened this issue Jul 12, 2024 · 0 comments · Fixed by #6141
Closed
Assignees
Labels
component/kubernetes-model Deals with the kubernetes-model
Milestone

Comments

@manusa
Copy link
Member

manusa commented Jul 12, 2024

Description

Part of #6130

To be able to generate the Java types easily we need a way to invoke the generator project-wise (Maven).
The easiest approach is to create a Maven plugin that can be easily added to each model module and that will be triggered as part of the model build process.

Specifications

  • Implement a new Maven module packaged as openapi-model-generator-maven-plugin in kubernetes-model-generator/openapi/maven-plugin:
    io.fabric8:openapi-model-generator-maven-plugin
  • This is an internal module, so it shouldn't be published to Maven Central:
    <maven.deploy.skip>true</maven.deploy.skip>
  • The plugin should provide support to define the following settings:
    Configuration Description
    schemas* List of OpenAPI schema files (*.json) to process
    outputDirectory* Directory where generated Java classes should be persisted
    packageName* Name of the base package for the generated Java classes
    builderPackage* Target package for Sundrio-generated builder classes
    addBuildableReferences Whether to add buildable references to generated classes (should be true for non-core models)
    packageMappings Additional mappings to output classes to packages different than packageName
    skipGenerationRegexes List of definition regexes to skip in the generation
    includeGenerationRegexes List of definition regexes to include in the generation
    generateJavadoc Add Javadoc comments from OpenAPI descriptions
    generatedSourcesDirectory Optional, defaults to $outputDirectory/src/generated/java
    overridesDirectory Optional, defaults to $outputDirectory/src/main/java
  • Generator cleans output directory before processing the schema(s)
  • Generator allows for providing multiple schemas
    • Schemas are processed in order
    • The most recent processed schema overwrites any class that has been defined by a previous schema
@manusa manusa self-assigned this Jul 12, 2024
@manusa manusa added this to the 7.0.0 milestone Jul 12, 2024
@manusa manusa moved this to In Progress in Eclipse JKube Jul 12, 2024
@manusa manusa moved this from In Progress to Review in Eclipse JKube Jul 16, 2024
@manusa manusa added the component/kubernetes-model Deals with the kubernetes-model label Jul 17, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in Eclipse JKube Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/kubernetes-model Deals with the kubernetes-model
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant