|
| 1 | += Contributing to springdoc-openapi |
| 2 | + |
| 3 | +springdoc-openapi is released under the Apache 2.0 license. If you would like to contribute |
| 4 | +something, or simply want to hack on the code this document should help you get started. |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +== Code of Conduct |
| 9 | +This project adheres to the Contributor Covenant link:CODE_OF_CONDUCT.adoc[code of |
| 10 | +conduct]. By participating, you are expected to uphold this code. |
| 11 | + |
| 12 | + |
| 13 | +== Using GitHub Issues |
| 14 | +We use GitHub issues to track bugs and enhancements. If you have a general usage question |
| 15 | +please ask on https://stackoverflow.com[Stack Overflow]. The springdoc-openapi team and the |
| 16 | +broader community monitor the https://stackoverflow.com/tags/springdoc[`springdoc`] |
| 17 | +tag. |
| 18 | + |
| 19 | +These are some basic guidelines before opening an issue. First of all you need to make sure, you don't create duplicate issues, and there no question already answred on https://stackoverflow.com/tags/springdoc. |
| 20 | + |
| 21 | +If you are starting using springdoc-openapi, we advise you to use the last available release. |
| 22 | + |
| 23 | +Then refer to the relevant documentation: |
| 24 | + |
| 25 | +1. For OpenAPI specification 3: |
| 26 | + - https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md |
| 27 | +2. For swagger2-annotations: |
| 28 | + - https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations |
| 29 | +3. For swagger-ui configuration: |
| 30 | + - https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md |
| 31 | +4. For springdoc-openapi: |
| 32 | + - https://springdoc.github.io/springdoc-openapi-demos/ |
| 33 | + - https://springdoc.github.io/springdoc-openapi-demos/faq.html |
| 34 | + - https://springdoc.github.io/springdoc-openapi-demos/migrating-from-springfox.html |
| 35 | + |
| 36 | + |
| 37 | +If you are reporting a bug, please help to speed up problem diagnosis by providing as |
| 38 | +much information as possible: |
| 39 | + |
| 40 | + - You need to describe your context (the title of an issue is not enough) |
| 41 | + - What version of spring-boot you are using? |
| 42 | + - What modules and versions of springdoc-openapi are you using? |
| 43 | + - What are the actual and the expected result using OpenAPI Description (yml or json)? |
| 44 | + - Provide with a sample code (HelloController) or Test that reproduces the problem |
| 45 | + |
| 46 | + |
| 47 | +== Reporting Security Vulnerabilities |
| 48 | +If you think you have found a security vulnerability in Spring Boot please *DO NOT* |
| 49 | +disclose it publicly until we've had a chance to fix it. Please don't report security |
| 50 | +vulnerabilities using GitHub issues, instead head over to [email protected] and |
| 51 | +learn how to disclose them responsibly. |
| 52 | + |
| 53 | + |
| 54 | +== Code Conventions and Housekeeping |
| 55 | +None of these is essential for a pull request, but they will all help. They can also be |
| 56 | +added after the original pull request but before a merge. |
| 57 | + |
| 58 | +* We use the https://github.com/spring-io/spring-javaformat/[Spring JavaFormat] project |
| 59 | + to apply code formatting conventions. If you use Eclipse and you follow the '`Importing |
| 60 | + into eclipse`' instructions below you should get project specific formatting |
| 61 | + automatically. You can also install the |
| 62 | + https://github.com/spring-io/spring-javaformat/#intellij-idea[Spring JavaFormat IntelliJ |
| 63 | + Plugin] |
| 64 | +* Make sure all new `.java` files to have a simple Javadoc class comment with at least an |
| 65 | + `@author` tag identifying you, and preferably at least a paragraph on what the class is |
| 66 | + for. |
| 67 | +* Add the ASF license header comment to all new `.java` files (copy from existing files |
| 68 | + in the project) |
| 69 | +* Add yourself as an `@author` to the `.java` files that you modify substantially (more |
| 70 | + than cosmetic changes). |
| 71 | +* Add some Javadocs. |
| 72 | +* A few unit tests would help a lot as well -- someone has to do it. |
| 73 | +* If no-one else is using your branch, please rebase it against the current master (or |
| 74 | + other target branch in the main project). |
| 75 | +* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], |
| 76 | + if you are fixing an existing issue please add `Fixes #XXXX` at the end of the commit |
| 77 | + message (where `XXXX` is the issue number). |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +== Working with the Code |
| 82 | +If you don't have an IDE preference we would recommend that you use IntellIJ. |
| 83 | + |
| 84 | +=== Importing into IntelliJ IDEA |
| 85 | +If you have performed a checkout of this repository already, use "`File`" -> "`Open`" and |
| 86 | +then select the root `build.gradle` file to import the code. |
| 87 | + |
| 88 | +Alternatively, you can let IntellIJ IDEA checkout the code for you. Use "`File`" -> |
| 89 | +"`New`" -> "`Project from Version Control`" and |
| 90 | +`https://github.com/spring-projects/spring-boot` for the URL. Once the checkout has |
| 91 | +completed, a pop-up will suggest to open the project. |
| 92 | + |
| 93 | + |
| 94 | +==== Install the Spring Formatter plugin |
| 95 | +If you haven't done so, install the formatter plugin so that proper formatting rules are |
| 96 | +applied automatically when you reformat code in the IDE. |
| 97 | + |
| 98 | +* Download the latest https://search.maven.org/search?q=g:io.spring.javaformat%20AND%20a:spring-javaformat-intellij-plugin[IntelliJ IDEA plugin]. |
| 99 | +* Select "`IntelliJ IDEA`" -> "`Preferences`". |
| 100 | +* Select "`Plugins`". |
| 101 | +* Select the wheel and "`Install Plugin from Disk...`". |
| 102 | +* Select the jar file you've downloaded. |
| 103 | + |
| 104 | + |
| 105 | +==== Import additional code style |
| 106 | +The formatter does not cover all rules (such as order of imports) and an additional file |
| 107 | +needs to be added. |
| 108 | + |
| 109 | +* Select "`IntelliJ IDEA`" -> "`Preferences`". |
| 110 | +* Select "`Editor`" -> "`Code Style`". |
| 111 | +* Select the wheel and "`Import Scheme`" -> "`IntelliJ IDEA code style XML`". |
| 112 | +* Select https://github.com/spring-projects/spring-boot/blob/master/idea/codeStyleConfig.xml[`idea/codeStyleConfig.xml`] from this repository. |
| 113 | + |
| 114 | +==== Importing into Eclipse |
| 115 | + |
| 116 | +You can use Spring Boot project specific source formatting settings. |
| 117 | + |
| 118 | + |
| 119 | +===== Install the Spring Formatter plugin |
| 120 | +* Select "`Help`" -> "`Install New Software`". |
| 121 | +* Add `https://dl.bintray.com/spring/javaformat-eclipse/` as a site. |
| 122 | +* Install "Spring Java Format". |
| 123 | + |
| 124 | +NOTE: The plugin is optional. Projects can be imported without the plugins, your code |
| 125 | +changes just won't be automatically formatted. |
| 126 | + |
| 127 | +=== Building from Source |
| 128 | +springdoc-openapi source can be built from the command line using https://maven.apache.org/[Maven] on |
| 129 | +JDK 1.8 or above. |
| 130 | + |
| 131 | +The project can be built from the root directory using the standard maven command: |
| 132 | + |
| 133 | +[indent=0] |
| 134 | +---- |
| 135 | + $ ./mvn install |
| 136 | +---- |
| 137 | + |
| 138 | + |
| 139 | +== Cloning the git repository on Windows |
| 140 | +Some files in the git repository may exceed the Windows maximum file path (260 |
| 141 | +characters), depending on where you clone the repository. If you get `Filename too long` |
| 142 | +errors, set the `core.longPaths=true` git option: |
| 143 | + |
| 144 | +``` |
| 145 | +git clone -c core.longPaths=true https://github.com/springdoc/springdoc-openapi |
| 146 | +``` |
0 commit comments