kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

The copyInstance method in the Fluent generated by the Java code generator is missing the class field.

Open dcais opened this issue 1 year ago • 3 comments
trafficstars

Describe the bug

The copyInstance method in the Fluent generated by the Java code generator is missing the class field.

CRD is like below.

...
                  storage:
                    description: Storage configuration (disk). Cannot be updated.
                    properties:
                      class:
                        description: The storage class to use for dynamic volume allocation.
                        type: string
                      deleteClaim:
                        description: Specifies if the persistent volume claim has
                          to be deleted when the cluster is un-deployed.
                        type: boolean
                      id:
                        description: Storage identification number. It is mandatory
                          only for storage volumes defined in a storage of type 'jbod'.
                        minimum: 0
                        type: integer
                      overrides:
  ...
public class VolumesFluent<A extends VolumesFluent<A>> extends BaseFluent<A>{
  public VolumesFluent() {
  }
  
  public VolumesFluent(Volumes instance) {
    this.copyInstance(instance);
  }
  private Boolean deleteClaim;
  private Long id;
  private ArrayList<OverridesBuilder> overrides;
  private SelectorBuilder selector;
  private String size;
  private String sizeLimit;
  private Volumes.Type type;
  private Map<String,Object> additionalProperties;
  
  protected void copyInstance(Volumes instance) {
    instance = (instance != null ? instance : new Volumes());
    if (instance != null) {
          this.withDeleteClaim(instance.getDeleteClaim());
          this.withId(instance.getId());
          // class setting is missing 
          this.withOverrides(instance.getOverrides());
          this.withSelector(instance.getSelector());
          this.withSize(instance.getSize());
          this.withSizeLimit(instance.getSizeLimit());
          this.withType(instance.getType());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  

Fabric8 Kubernetes Client version

6.13.0

Steps to reproduce

just generator the java code from CRD

Expected behavior

generate the right class field setting method

Runtime

other (please specify in additional context)

Kubernetes API Server version

other (please specify in additional context)

Environment

macOS

Fabric8 Kubernetes Client Logs

no need

Additional context

no need

dcais avatar Jun 20 '24 06:06 dcais

@dcais this appears to be a CRD java generator issue, not a sundrio / fluent issue - the snippet you are showing does not have a "class" field at all.

We have re-written the CRD generator for the upcoming 7.0 release. More than likely this case will work with that version.

shawkins avatar Jun 20 '24 11:06 shawkins

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Sep 28 '24 05:09 stale[bot]

@dcais I think you are talking about the java-generator here and not the CRD generator, can you please confirm?

I tested the java-generatorand for theclass` field you get this Java code:

  /**
     * The storage class to use for dynamic volume allocation.
     */
    @com.fasterxml.jackson.annotation.JsonProperty("class")
    @com.fasterxml.jackson.annotation.JsonPropertyDescription("The storage class to use for dynamic volume allocation.")
    @com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
    private String _class;

    public String get_class() {
        return _class;
    }

    public void set_class(String _class) {
        this._class = _class;
    }

that seems reasonable to me. We need to confirm if sundrio supports creating the fluent API for the _class field.

andreaTP avatar Sep 28 '24 12:09 andreaTP

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Mar 03 '25 10:03 stale[bot]