|
1 | 1 | # 📝 Documentify |
| 2 | +[](http://kotlinlang.org) |
2 | 3 |  |
3 | 4 | [](https://opensource.org/licenses/Apache-2.0) |
4 | 5 | <br> |
@@ -35,7 +36,7 @@ fun setUp(provider: RestDocumentationContextProvider) { |
35 | 36 | ``` |
36 | 37 | You can also set up the test environment with an application context or an auto-configured MockMvc (or WebTestClient). |
37 | 38 | <br><br> |
38 | | -`Mvc Example` |
| 39 | +`MVC Example` |
39 | 40 | ```kotlin |
40 | 41 | webApplicationContext(provider, context) |
41 | 42 | mockMvc(provider, mockMvc) |
@@ -77,11 +78,29 @@ fun documentationGetApi() { |
77 | 78 | } |
78 | 79 | ``` |
79 | 80 |
|
| 81 | +Additional validation of the mock response generated during the tests for document creation is also possible. |
| 82 | +```kotlin |
| 83 | +@Test |
| 84 | +fun documentationGetApi() { |
| 85 | + documentation("test-get-api") { |
| 86 | + information { |
| 87 | + summary("test get api") |
| 88 | + description("this is test get api") |
| 89 | + tag("test") |
| 90 | + } |
| 91 | + requestLine(Method.GET, "/api/test/{path}") |
| 92 | + responseBody { |
| 93 | + field("testField", "test", "test") |
| 94 | + } |
| 95 | + }.expect(jsonPath("$testField").value("test")) |
| 96 | +} |
| 97 | +``` |
| 98 | + |
80 | 99 | ### Generate OpenAPI Specification |
81 | 100 | After setting up the test environment and writing the test code, run the test. |
82 | 101 | The OpenAPI specification document will be generated in the `build/generated-snippets` directory. |
83 | 102 |
|
84 | | -First, apply documentify plugin to your `build.gradle.kts` file: |
| 103 | +First, apply documentify plugin to your `build.gradle.kts` file *(need gradle plugin portal)*: |
85 | 104 | ```kotlin |
86 | 105 | plugins { |
87 | 106 | id("io.github.bgmsound.documentify") version "${version}" |
@@ -112,3 +131,6 @@ you can also create Postman collection by running the following command: |
112 | 131 |
|
113 | 132 | ## Documentify Development Story |
114 | 133 | If you want to check out the development story of Documentify, please refer to the [blog post](https://bgmsound.medium.com/documentify-선언형-rest-docs-dsl-제작기-0a09f651be2c). |
| 134 | + |
| 135 | +## License |
| 136 | +documentify is Open Source software released under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html). |
0 commit comments