fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.4k stars 1.46k forks source link

[java-generator] Improve the docs to include examples of the options #5285

Open andreaTP opened 1 year ago

andreaTP commented 1 year ago

Is your enhancement related to a problem? Please describe

Currently, the docs are listing the available options for the plugins and the CLI, but there are no examples of "how to use them" and the expected output.

Describe the solution you'd like

We should describe the available options and include snippets of the usage and how it affects the generation.

Describe alternatives you've considered

No response

Additional context

No response

g1rjeevan commented 1 year ago

/assign

shubhamvrs commented 1 year ago

/assign

shubhamvrs commented 1 year ago

Enhancement Proposal: Improving Documentation with Examples of Java Generator Options

Problem: The current documentation for the Java generator lacks practical examples of how to use the available options and how they affect the generated code. Users might find it difficult to understand how to utilize these options effectively without concrete examples.

Solution: To address this problem, we propose enhancing the documentation for the Java generator by providing clear and concise examples of how to use each option. Each option should be accompanied by code snippets that demonstrate its usage and illustrate the impact on the output.

Java Generator Options and Examples:

Option: setPackageName(String packageName)

Description: Sets the package name for the generated Java code. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setPackageName("com.example.generated"); The output will have the following package declaration:

java Copy code package com.example.generated; Option: setClassName(String className)

Description: Sets the name of the main class in the generated Java code. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setClassName("MyGeneratedClass"); The output will have the following class declaration:

java Copy code public class MyGeneratedClass { // ... (class contents) } Option: setClassModifiers(List modifiers)

Description: Sets the modifiers (e.g., "public," "final," "abstract") for the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setClassModifiers(Arrays.asList("public", "final")); The output will have the following class declaration:

java Copy code public final class MainClass { // ... (class contents) } Option: addField(String fieldDeclaration)

Description: Adds a field declaration to the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.addField("private int age;"); The output will include the following field declaration inside the class:

java Copy code private int age; Option: addMethod(String methodDeclaration)

Description: Adds a method declaration to the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.addMethod("public void printMessage() { System.out.println(\"Hello!\"); }"); The output will include the following method declaration inside the class:

java Copy code public void printMessage() { System.out.println("Hello!"); }

andreaTP commented 1 year ago

Hi @shubhamvrs and thanks for your interest!

To complete this task we do expect a PR expanding this section of the current docs: https://github.com/fabric8io/kubernetes-client/blob/main/doc/java-generation-from-CRD.md#usage

Would you be able to provide it?

shubhamvrs commented 1 year ago

i tried my best sir but im unable to create it actually im new to github thatswhy !

rohanKanojia commented 1 year ago

@shubhamvrs : Could you please elaborate? What problem are you facing?

shubhamvrs commented 1 year ago

@rohanKanojia im not able to provide a PR expanding this section: ( https://github.com/fabric8io/kubernetes-client/blob/main/doc/java-generation-from-CRD.md#) usage of the current docs that i have created previously

rohanKanojia commented 1 year ago

@shubhamvrs : Do you mean you don't have enough knowledge about java generator to improve existing documentation?

shubhamvrs commented 1 year ago

im unable to create new file in given format with given path in new pull request

rohanKanojia commented 1 year ago

@shubhamvrs : Why is that so? Are you getting some error?

shubhamvrs commented 1 year ago

@rohanKanojia its just im unable to create a file on given format. I have the doc but file needs to be converted in given format !

rohanKanojia commented 1 year ago

I'm not able to understand what you're saying. Which document are you talking about?

shubhamvrs commented 1 year ago

Enhancement Proposal: Improving Documentation with Examples of Java Generator Options

Problem: The current documentation for the Java generator lacks practical examples of how to use the available options and how they affect the generated code. Users might find it difficult to understand how to utilize these options effectively without concrete examples.

Solution: To address this problem, we propose enhancing the documentation for the Java generator by providing clear and concise examples of how to use each option. Each option should be accompanied by code snippets that demonstrate its usage and illustrate the impact on the output.

Java Generator Options and Examples:

Option: setPackageName(String packageName)

Description: Sets the package name for the generated Java code. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setPackageName("com.example.generated"); The output will have the following package declaration:

java Copy code package com.example.generated; Option: setClassName(String className)

Description: Sets the name of the main class in the generated Java code. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setClassName("MyGeneratedClass"); The output will have the following class declaration:

java Copy code public class MyGeneratedClass { // ... (class contents) } Option: setClassModifiers(List modifiers)

Description: Sets the modifiers (e.g., "public," "final," "abstract") for the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.setClassModifiers(Arrays.asList("public", "final")); The output will have the following class declaration:

java Copy code public final class MainClass { // ... (class contents) } Option: addField(String fieldDeclaration)

Description: Adds a field declaration to the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.addField("private int age;"); The output will include the following field declaration inside the class:

java Copy code private int age; Option: addMethod(String methodDeclaration)

Description: Adds a method declaration to the main class. Example: java Copy code JavaGenerator generator = new JavaGenerator(); generator.addMethod("public void printMessage() { System.out.println("Hello!"); }"); The output will include the following method declaration inside the class:

java Copy code public void printMessage() { System.out.println("Hello!"); }

shubhamvrs commented 1 year ago

@rohanKanojia

rohanKanojia commented 1 year ago

@shubhamvrs : This doesn't look correct to me. You need to add examples of options of CLI and maven plugin. Users won't be using JavaGenerator class directly. You need to add example output as well.

I'm afraid working with this issue requires knowledge about Kubernetes, Custom Resources, and maven. I think it is not a good fit for your skills.

shubhamvrs commented 1 year ago

@rohanKanojia okayy

rohanKanojia commented 1 year ago

@shubhamvrs : Please don't get discouraged by my comment. You're still welcome to contribute. But perhaps you should start with something really simple as a first contribution (maybe correcting grammar mistakes, fixing/improving tests, etc)

shubhamvrs commented 1 year ago

@rohanKanojia sure sir i will😊

AlishRani commented 1 year ago

/assign

heralgi commented 1 year ago

/assign

manusa commented 1 year ago

Note, there is no bot controlling the issue assignment so `/assign' won't work.

If you're willing to work on the issue, just ask so politely :slightly_smiling_face:

Also, make sure to understand what's requested and how to proceed. We might assist you a little, but we do expect a minimum knowledge of what you're handling here.

Mandeep56Singh commented 1 year ago

i want to contribute to this repo , i only know java . Which other things do i need to know in order to contribute ( good contribution) Please help, I am beginner in open source contribution

Mandeep56Singh commented 1 year ago

I will learn whatever needed to shut down this issue . I just need your help .

andreaTP commented 1 year ago

@Mandeep56Singh this is the expectation: https://github.com/fabric8io/kubernetes-client/issues/5285#issuecomment-1667581394

Let us know if you have further questions.

Mandeep56Singh commented 1 year ago

@andreaTP could you please tell what knowledge should I have to work on this issue ? I only know java ( mostly for algorithms)

andreaTP commented 1 year ago

https://github.com/fabric8io/kubernetes-client/issues/5285#issuecomment-1669384642

stale[bot] commented 9 months ago

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] commented 6 months ago

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!