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

Generate java required getters for required spec and/or status #6802

Open
matteriben opened this issue Jan 17, 2025 · 2 comments
Open

Generate java required getters for required spec and/or status #6802

matteriben opened this issue Jan 17, 2025 · 2 comments

Comments

@matteriben
Copy link
Contributor

Is your enhancement related to a problem? Please describe

Required spec/status in CRD is not reflected in generated Java.

Describe the solution you'd like

I'd like the java generator to add annotated getters for spec/status to the generated custom resource class if the spec/status is required in the CRD.

Describe alternatives you've considered

No response

Additional context

No response

@andreaTP
Copy link
Member

Hi @matteriben , I'm not 100% sure about the request here, would you mind drafting a little example with:

  • the original CRD
  • the current java-generator output
  • the expected improvement

afaiu the getters for spec and status are already available ( e.g. ).

@matteriben
Copy link
Contributor Author

Hi @andreaTP I'm sorry my original request was not clear without an example.

Given a CRD like this:

        openAPIV3Schema:
          type: object
          required:
            - spec
            - status
          properties:
            spec:
              type: object
            status:
              type: object

The generator currently creates a class like this:

public class Required extends CustomResource<RequiredSpec, RequiredStatus> {
}

I'd like the generator to create a class like this:

public class Required extends CustomResource<RequiredSpec, RequiredStatus> {

  @java.lang.Override
  @io.fabric8.generator.annotation.Required
  public RequiredSpec getSpec() {
    return super.getSpec();
  }

  @java.lang.Override
  @io.fabric8.generator.annotation.Required
  public RequiredStatus getStatus() {
    return super.getStatus();
  }
}

I created a PR which provides an implementation of this requested enhancement:
#6807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants