|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Java 11+ |
| 10 | +- Gradle |
| 11 | + |
| 12 | +### Installation |
| 13 | + |
| 14 | +Install the project dependencies: |
| 15 | + |
| 16 | +```bash |
| 17 | +./gradlew build |
| 18 | +``` |
| 19 | + |
| 20 | +### Building |
| 21 | + |
| 22 | +Build the project: |
| 23 | + |
| 24 | +```bash |
| 25 | +./gradlew build |
| 26 | +``` |
| 27 | + |
| 28 | +### Testing |
| 29 | + |
| 30 | +Run the test suite: |
| 31 | + |
| 32 | +```bash |
| 33 | +./gradlew test |
| 34 | +``` |
| 35 | + |
| 36 | +### Formatting |
| 37 | + |
| 38 | +Check and fix code style: |
| 39 | + |
| 40 | +```bash |
| 41 | +./gradlew spotlessApply |
| 42 | +``` |
| 43 | + |
| 44 | +## About Generated Code |
| 45 | + |
| 46 | +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. |
| 47 | + |
| 48 | +### Generated Files |
| 49 | + |
| 50 | +The following directories contain generated code: |
| 51 | +- `src/` - API client classes and types |
| 52 | +- Most Java files in the project |
| 53 | + |
| 54 | +### How to Customize |
| 55 | + |
| 56 | +If you need to customize the SDK, you have two options: |
| 57 | + |
| 58 | +#### Option 1: Use `.fernignore` |
| 59 | + |
| 60 | +For custom code that should persist across SDK regenerations: |
| 61 | + |
| 62 | +1. Create a `.fernignore` file in the project root |
| 63 | +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) |
| 64 | +3. Add your custom code to those files |
| 65 | + |
| 66 | +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. |
| 67 | + |
| 68 | +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). |
| 69 | + |
| 70 | +#### Option 2: Contribute to the Generator |
| 71 | + |
| 72 | +If you want to change how code is generated for all users of this SDK: |
| 73 | + |
| 74 | +1. The Java SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) |
| 75 | +2. Generator code is located at `generators/java-v2/` |
| 76 | +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) |
| 77 | +4. Submit a pull request with your changes to the generator |
| 78 | + |
| 79 | +This approach is best for: |
| 80 | +- Bug fixes in generated code |
| 81 | +- New features that would benefit all users |
| 82 | +- Improvements to code generation patterns |
| 83 | + |
| 84 | +## Making Changes |
| 85 | + |
| 86 | +### Workflow |
| 87 | + |
| 88 | +1. Create a new branch for your changes |
| 89 | +2. Make your modifications |
| 90 | +3. Run tests to ensure nothing breaks: `./gradlew test` |
| 91 | +4. Run formatting: `./gradlew spotlessApply` |
| 92 | +5. Build the project: `./gradlew build` |
| 93 | +6. Commit your changes with a clear commit message |
| 94 | +7. Push your branch and create a pull request |
| 95 | + |
| 96 | +### Commit Messages |
| 97 | + |
| 98 | +Write clear, descriptive commit messages that explain what changed and why. |
| 99 | + |
| 100 | +### Code Style |
| 101 | + |
| 102 | +This project uses automated code formatting. Run `./gradlew spotlessApply` before committing to ensure your code meets the project's style guidelines. |
| 103 | + |
| 104 | +## Questions or Issues? |
| 105 | + |
| 106 | +If you have questions or run into issues: |
| 107 | + |
| 108 | +1. Check the [Fern documentation](https://buildwithfern.com) |
| 109 | +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) |
| 110 | +3. Open a new issue if your question hasn't been addressed |
| 111 | + |
| 112 | +## License |
| 113 | + |
| 114 | +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. |
0 commit comments