xref: /aosp_15_r20/external/kotlinx.serialization/CONTRIBUTING.md (revision 57b5a4a64c534cf7f27ac9427ceab07f3d8ed3d8)
1*57b5a4a6SAndroid Build Coastguard Worker# Contributing Guidelines
2*57b5a4a6SAndroid Build Coastguard Worker
3*57b5a4a6SAndroid Build Coastguard WorkerThere are two main ways to contribute to the project — submitting issues and submitting
4*57b5a4a6SAndroid Build Coastguard Workerfixes/changes/improvements via pull requests.
5*57b5a4a6SAndroid Build Coastguard Worker
6*57b5a4a6SAndroid Build Coastguard Worker## Submitting issues
7*57b5a4a6SAndroid Build Coastguard Worker
8*57b5a4a6SAndroid Build Coastguard WorkerBoth bug reports and feature requests are welcome.
9*57b5a4a6SAndroid Build Coastguard WorkerSubmit issues [here](https://github.com/Kotlin/kotlinx.serialization/issues).
10*57b5a4a6SAndroid Build Coastguard Worker
11*57b5a4a6SAndroid Build Coastguard Worker* Search for existing issues to avoid reporting duplicates.
12*57b5a4a6SAndroid Build Coastguard Worker* When submitting a bug report:
13*57b5a4a6SAndroid Build Coastguard Worker  * Use a 'bug report' template when creating a new issue.
14*57b5a4a6SAndroid Build Coastguard Worker  * Test it against the most recently released version. It might have been already fixed.
15*57b5a4a6SAndroid Build Coastguard Worker  * By default, we assume that your problem reproduces in Kotlin/JVM. Please, mention if the problem is
16*57b5a4a6SAndroid Build Coastguard Worker    specific to Kotlin/JS or Kotlin/Native.
17*57b5a4a6SAndroid Build Coastguard Worker  * Include the code that reproduces the problem. Provide the complete reproducer code, yet minimize it as much as possible.
18*57b5a4a6SAndroid Build Coastguard Worker  * However, don't put off reporting any weird or rarely appearing issues just because you cannot consistently
19*57b5a4a6SAndroid Build Coastguard Worker    reproduce them.
20*57b5a4a6SAndroid Build Coastguard Worker  * If the bug is in behavior, then explain what behavior you've expected and what you've got.
21*57b5a4a6SAndroid Build Coastguard Worker* When submitting a feature request:
22*57b5a4a6SAndroid Build Coastguard Worker  * Use a 'feature request' template when creating a new issue.
23*57b5a4a6SAndroid Build Coastguard Worker  * Explain why you need the feature — what's your use-case, what's your domain.
24*57b5a4a6SAndroid Build Coastguard Worker  * Explaining the problem you face is more important than suggesting a solution.
25*57b5a4a6SAndroid Build Coastguard Worker    Even if you don't have a proposed solution, please report your problem.
26*57b5a4a6SAndroid Build Coastguard Worker  * If there is an alternative way to do what you need, then show the code of the alternative.
27*57b5a4a6SAndroid Build Coastguard Worker
28*57b5a4a6SAndroid Build Coastguard Worker## Submitting PRs
29*57b5a4a6SAndroid Build Coastguard Worker
30*57b5a4a6SAndroid Build Coastguard WorkerWe love PRs. Submit PRs [here](https://github.com/Kotlin/kotlinx.serialization/pulls).
31*57b5a4a6SAndroid Build Coastguard WorkerHowever, please keep in mind that maintainers will have to support the resulting code of the project,
32*57b5a4a6SAndroid Build Coastguard Workerso do familiarize yourself with the following guidelines.
33*57b5a4a6SAndroid Build Coastguard Worker
34*57b5a4a6SAndroid Build Coastguard Worker* All development (both new features and bug fixes) is performed in the `dev` branch.
35*57b5a4a6SAndroid Build Coastguard Worker  * The `master` branch always contains sources of the most recently released version.
36*57b5a4a6SAndroid Build Coastguard Worker  * Base PRs against the `dev` branch.
37*57b5a4a6SAndroid Build Coastguard Worker  * The `dev` branch is pushed to the `master` branch during release.
38*57b5a4a6SAndroid Build Coastguard Worker  * Documentation in markdown files can be updated directly in the `master` branch,
39*57b5a4a6SAndroid Build Coastguard Worker    unless the documentation is in the source code, and the patch changes line numbers.
40*57b5a4a6SAndroid Build Coastguard Worker* If you fix documentation:
41*57b5a4a6SAndroid Build Coastguard Worker  * After fixing/changing code examples in the [`docs`](docs) folder or updating any references in the markdown files
42*57b5a4a6SAndroid Build Coastguard Worker    run the [Knit tool](#running-the-knit-tool) and commit the resulting changes as well.
43*57b5a4a6SAndroid Build Coastguard Worker    Your changes will not pass the tests otherwise.
44*57b5a4a6SAndroid Build Coastguard Worker  * If you plan extensive rewrites/additions to the docs, then please [contact the maintainers](#contacting-maintainers)
45*57b5a4a6SAndroid Build Coastguard Worker    to coordinate the work in advance.
46*57b5a4a6SAndroid Build Coastguard Worker* If you make any code changes:
47*57b5a4a6SAndroid Build Coastguard Worker  * Follow the [Kotlin Coding Conventions](https://kotlinlang.org/docs/reference/coding-conventions.html).
48*57b5a4a6SAndroid Build Coastguard Worker    * Use 4 spaces for indentation.
49*57b5a4a6SAndroid Build Coastguard Worker    * Use imports with '*'.
50*57b5a4a6SAndroid Build Coastguard Worker  * [Build the project](#building) to make sure it all works and passes the tests.
51*57b5a4a6SAndroid Build Coastguard Worker* If you fix a bug:
52*57b5a4a6SAndroid Build Coastguard Worker  * Write the test that reproduces the bug.
53*57b5a4a6SAndroid Build Coastguard Worker  * Fixes without tests are accepted only in exceptional circumstances if it can be shown that writing the
54*57b5a4a6SAndroid Build Coastguard Worker    corresponding test is too hard or otherwise impractical.
55*57b5a4a6SAndroid Build Coastguard Worker  * Follow the style of writing tests that is used in this project:
56*57b5a4a6SAndroid Build Coastguard Worker    name test functions as `testXxx`. Don't use backticks in test names.
57*57b5a4a6SAndroid Build Coastguard Worker* If you introduce any new public APIs:
58*57b5a4a6SAndroid Build Coastguard Worker  * All new APIs must come with documentation and tests.
59*57b5a4a6SAndroid Build Coastguard Worker  * All new APIs are initially released with `@ExperimentalSerializationApi` annotation and are graduated later.
60*57b5a4a6SAndroid Build Coastguard Worker  * [Update the public API dumps](#updating-the-public-api-dump) and commit the resulting changes as well.
61*57b5a4a6SAndroid Build Coastguard Worker    It will not pass the tests otherwise.
62*57b5a4a6SAndroid Build Coastguard Worker  * If you plan large API additions, then please start by submitting an issue with the proposed API design
63*57b5a4a6SAndroid Build Coastguard Worker    to gather community feedback.
64*57b5a4a6SAndroid Build Coastguard Worker  * [Contact the maintainers](#contacting-maintainers) to coordinate any big piece of work in advance.
65*57b5a4a6SAndroid Build Coastguard Worker* If you propose/implement a new serialization format:
66*57b5a4a6SAndroid Build Coastguard Worker  * Follow the general advice on new public APIs above.
67*57b5a4a6SAndroid Build Coastguard Worker  * Note, that you can keep new format implementation in your own repository to be able to perform proper maintenance
68*57b5a4a6SAndroid Build Coastguard Worker    and to have a separate release cycle.
69*57b5a4a6SAndroid Build Coastguard Worker  * You can submit a PR to the [list of community-supported formats](formats/README.md#other-community-supported-formats)
70*57b5a4a6SAndroid Build Coastguard Worker    with a description of your library.
71*57b5a4a6SAndroid Build Coastguard Worker* Comment on the existing issue if you want to work on it. Ensure that the issue not only describes a problem,
72*57b5a4a6SAndroid Build Coastguard Worker  but also describes a solution that has received positive feedback. Propose a solution if there isn't any.
73*57b5a4a6SAndroid Build Coastguard Worker
74*57b5a4a6SAndroid Build Coastguard Worker## Building
75*57b5a4a6SAndroid Build Coastguard Worker
76*57b5a4a6SAndroid Build Coastguard WorkerYou can find all the instructions [here](docs/building.md)
77*57b5a4a6SAndroid Build Coastguard Worker
78*57b5a4a6SAndroid Build Coastguard Worker### Running the Knit tool
79*57b5a4a6SAndroid Build Coastguard Worker
80*57b5a4a6SAndroid Build Coastguard Worker* Use [Knit](https://github.com/Kotlin/kotlinx-knit/blob/master/README.md) for updates to documentation:
81*57b5a4a6SAndroid Build Coastguard Worker  * Run `./gradlew knit` to update example files, links, tables of content.
82*57b5a4a6SAndroid Build Coastguard Worker  * Commit updated documents and examples together with other changes.
83*57b5a4a6SAndroid Build Coastguard Worker
84*57b5a4a6SAndroid Build Coastguard Worker### Updating the public API dump
85*57b5a4a6SAndroid Build Coastguard Worker
86*57b5a4a6SAndroid Build Coastguard Worker* Use [Binary Compatibility Validator](https://github.com/Kotlin/binary-compatibility-validator/blob/master/README.md) for updates to public API:
87*57b5a4a6SAndroid Build Coastguard Worker  * Run `./gradlew apiDump` to update API index files.
88*57b5a4a6SAndroid Build Coastguard Worker  * Commit updated API indexes together with other changes.
89*57b5a4a6SAndroid Build Coastguard Worker
90*57b5a4a6SAndroid Build Coastguard Worker## Releases
91*57b5a4a6SAndroid Build Coastguard Worker
92*57b5a4a6SAndroid Build Coastguard Worker* Full release procedure checklist is [here](RELEASING.md).
93*57b5a4a6SAndroid Build Coastguard Worker
94*57b5a4a6SAndroid Build Coastguard Worker## Contacting maintainers
95*57b5a4a6SAndroid Build Coastguard Worker
96*57b5a4a6SAndroid Build Coastguard Worker* If something cannot be done, not convenient, or does not work — submit an [issue](#submitting-issues).
97*57b5a4a6SAndroid Build Coastguard Worker* "How to do something" questions — [StackOverflow](https://stackoverflow.com).
98*57b5a4a6SAndroid Build Coastguard Worker* Discussions and general inquiries — use `#serialization` channel in [KotlinLang Slack](https://kotl.in/slack).
99*57b5a4a6SAndroid Build Coastguard Worker
100