File tree Expand file tree Collapse file tree
modules/jooby-openapi/src/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package issues .i3230 ;
7+
8+ import static org .junit .jupiter .api .Assertions .assertEquals ;
9+
10+ import io .jooby .openapi .OpenAPIResult ;
11+ import io .jooby .openapi .OpenAPITest ;
12+ import kt .i3230 .App3230Kt ;
13+
14+ public class Issue3230 {
15+
16+ @ OpenAPITest (value = App3230Kt .class )
17+ public void shouldSupportExtensionMethod (OpenAPIResult result ) {
18+ assertEquals (
19+ "openapi: 3.0.1\n "
20+ + "info:\n "
21+ + " title: 3230 API\n "
22+ + " description: 3230 API description\n "
23+ + " version: \" 1.0\" \n "
24+ + "paths:\n "
25+ + " /hello:\n "
26+ + " get:\n "
27+ + " operationId: getHello\n "
28+ + " responses:\n "
29+ + " \" 200\" :\n "
30+ + " description: Success\n "
31+ + " content:\n "
32+ + " application/json:\n "
33+ + " schema:\n "
34+ + " type: string\n "
35+ + " /create:\n "
36+ + " post:\n "
37+ + " operationId: postCreate\n "
38+ + " responses:\n "
39+ + " \" 200\" :\n "
40+ + " description: Success\n "
41+ + " content:\n "
42+ + " application/json:\n "
43+ + " schema:\n "
44+ + " type: string\n " ,
45+ result .toYaml ());
46+ }
47+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package kt.i3230
7+
8+ import io.jooby.kt.Kooby
9+ import io.jooby.kt.runApp
10+
11+ // an extension method that creates some routes
12+ fun Kooby.helloRoute () {
13+ get(" /hello" ) { " world" }
14+
15+ post(" /create" ) { " world" }
16+ }
17+
18+ fun main (args : Array <String >) {
19+ runApp(args) {
20+ // calling the extension method
21+ helloRoute()
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments