Skip to content

Provide fluent nested builders for model objects. #137

Closed
@iocanel

Description

@iocanel

Currently, the generated model has a builder-like structure baked inside the model objects.
Given the depth of the model, it would really help if the builders supported more advanced features like nesting, visitors and in-lining (similar to what we have in the https://github.com/fabric8io/kubernetes-client).

nesting makes it so much easier to create model objects directly in java. It's faster to write, it's more IDE friendly etc.

visitors allow making changes, without having to explicitly traverse the object tree. (e.g. allows doing things like visit all Pod Specs in the tree and add a sidecar container without having to care if the spec is under a Deployment, DeploymentConfig, Pod, ReplicaSet etc).

in-lining allows to use the builder structure but instead of building the object directly to pass the object to a function. This allows to seamlessly integrate the builder into the client dsl.

Now, if we could get those builders either as part of the kubernetes module, it would open up the room of aligning with the https://github.com/fabric8io/kubernetes-client.

Activity

brendandburns

brendandburns commented on Dec 14, 2017

@brendandburns
Contributor

Feel free to start writing them :) io.kubernetes.client.fluent or somesuch...

We could also generate them, I suppose, but someone needs to write the generator...

brendandburns

brendandburns commented on Dec 14, 2017

@brendandburns
Contributor

(another option is to use protocol buffers and the proto-client which are somewhat more fluent, in some ways)

iocanel

iocanel commented on Dec 15, 2017

@iocanel
ContributorAuthor

@brendanburns: I've written a generator myself that we used for the fabric8 kubernetes-client.
So let'me try to integrate it and see how it goes.

pires

pires commented on Feb 16, 2018

@pires

@iocanel did you make any progress?

iocanel

iocanel commented on Feb 16, 2018

@iocanel
ContributorAuthor
brendandburns

brendandburns commented on Feb 27, 2018

@brendandburns
Contributor

@iocanel cool, would love to see it!

saturnism

saturnism commented on Apr 4, 2018

@saturnism

would love to see this merged! i enjoy the fabric8 client a lot :)

rhuss

rhuss commented on Jul 21, 2018

@rhuss

@iocanel I know, it has been some time and you are probably still very busy. But is there any chance for this PR still to happen ? 'would be really happy to help out here, too, as I think it would be a super awesome addition. We need something like this for the fabric8-maven-plugin to switch and would love to switch to kubernetes-client.

added a commit that references this issue on Jul 27, 2018

Merge pull request #323 from iocanel/fluent

2df55ef
brendandburns

brendandburns commented on Sep 7, 2018

@brendandburns
Contributor

This was fixed with #323 and #357 has an example.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rhuss@iocanel@pires@saturnism@brendandburns

        Issue actions

          Provide fluent nested builders for model objects. · Issue #137 · kubernetes-client/java