@@ -195,10 +195,80 @@ properties filter routes by their path pattern. The filter is a regular expressi
195195
196196=== JavaDoc comments
197197
198- Parsing of JavaDoc comment is supported on Java MVC/Controller .
198+ JavaDoc comments are supported on Java in script and MVC routes .
199199
200- .Java
201- [source,java]
200+ .Script routes
201+ [source,java, role="primary"]
202+ ----
203+
204+ /**
205+ * My Library.
206+ * @version 5.4.1
207+ * @tag Books. All about books.
208+ * @server.url https://books.api.com
209+ * @server.description Production
210+ * @x-logo https://my.api.com/logo.png
211+ */
212+ public class App extends Jooby {
213+ {
214+ install(new OpenAPIModule());
215+
216+ /*
217+ * Books operations.
218+ * @tag Books
219+ */
220+ path("/api/books", () -> {
221+ /*
222+ * Query and filter books.
223+ *
224+ * @param query Book filter.
225+ * @return List of matching books.
226+ * @operationId query
227+ */
228+ get("/", ctx -> {
229+ var query = ctx.query(BookQuery.class);
230+ });
231+ /*
232+ * Find a book by ISBN.
233+ * @param isbn ISBN code.
234+ * @return A book.
235+ * @throws BookNotFoundException When a book doesn't exist. <code>404</code>
236+ * @operationId bookByIsbn
237+ */
238+ get("/{isbn}", ctx -> {
239+ var query = ctx.query(BookQuery.class);
240+ });
241+ });
242+
243+ }
244+ }
245+
246+ /**
247+ * Book query.
248+ *
249+ * @type Book type.
250+ * @aga Book age.
251+ */
252+ public record BookQuery(BookType type, int age) {}
253+
254+ /**
255+ * Books can be broadly categorized into fiction and non-fiction
256+ */
257+ public enum BookType {
258+ /**
259+ * Fiction includes genres like fantasy, science fiction, romance, and mystery.
260+ */
261+ Fiction,
262+ /**
263+ * Non-fiction encompasses genres like history, biography, and self-help.
264+ */
265+ NonFiction
266+ }
267+
268+ ----
269+
270+ .MVC routes
271+ [source,java, role="secondary"]
202272----
203273
204274/**
@@ -209,7 +279,7 @@ Parsing of JavaDoc comment is supported on Java MVC/Controller.
209279* @server.description Production
210280* @x-logo https://my.api.com/logo.png
211281*/
212- public class App {
282+ public class App extends Jooby {
213283 {
214284 mvc(new Books_());
215285 install(new OpenAPIModule());
@@ -344,6 +414,12 @@ Whitespaces (including new lines) are ignored. To introduce a new line, you must
344414|[x]
345415|Shortcut for previous `@tag.name` and `@tag.description`. The tag name is everything before `.`
346416
417+ |@operationId <name>
418+ |
419+ |
420+ |[x]
421+ |Defined the operationId, useful for script routes.
422+
347423|@param <name>
348424|
349425|
@@ -364,14 +440,12 @@ Whitespaces (including new lines) are ignored. To introduce a new line, you must
364440
365441|===
366442
367- This feature is only available for Java MVC/controller routes. There are plans to support lambda
368- routes on Java. Kotlin source code is not supported.
443+ This feature is only available for Java routes. Kotlin source code is not supported.
369444
370445
371446=== Annotations
372447
373- To produce a better documentation, this plugin depends on some OpenAPI annotations. To use them, you
374- need to add a dependency to your project:
448+ Optionally this plugin depends on some OpenAPI annotations. To use them, you need to add a dependency to your project:
375449
376450[dependency, artifactId="swagger-annotations"]
377451.
@@ -430,7 +504,7 @@ fun findPetById(ctx: Context) : Pet {
430504----
431505
432506The OpenAPI annotations complement the openAPI byte code parser by adding documentation
433- or being more specific about a operation, parameter, response type, response status, etc.
507+ or being more specific about an operation, parameter, response type, response status, etc.
434508
435509Annotations works as documentation but also as a way to override what was generated by the byte
436510code parser.
0 commit comments