From 3588ffd64a5e46624a0cd102d05d075d9574325d Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:16:43 +0900 Subject: [PATCH] =?UTF-8?q?2023-10-06=E3=81=AE=E8=A8=98=E4=BA=8B=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/posts/2023-10-06/index.md | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 content/posts/2023-10-06/index.md diff --git a/content/posts/2023-10-06/index.md b/content/posts/2023-10-06/index.md new file mode 100644 index 0000000..acb1787 --- /dev/null +++ b/content/posts/2023-10-06/index.md @@ -0,0 +1,44 @@ +--- +author: usbharu +draft: false +categories: + - 技術 +date: 2023-10-06T12:05:47+09:00 +tags: + - OpenAPI + - Kotlin + - SpringBoot + - Mustache +keywords: + - OpenAPI + - Kotlin + - SpringBoot + - Mustache +title: OpenAPI Generatorで使われてるmustacheで配列のindexを得る +relpermalink: posts/2023-10-06/ +url: posts/2023-10-06/ +decription: OpenAPI Generatorで使われてるmustacheで配列のindexを得る +--- + +ハゲそうになったので誰かの役に立ったらとここに書いておく + +`-index`を使う + +```mustache +{{#list}} +{{-index}} +{{/list}} +``` + +# OpenAPI Generator で使われているのは mustache.java ではない + +OpenAPI Generator で使われているのは mustache.java ではありません。 +なので拡張記法として有名なものは使用できません。 + +使用されているのは jmustache というもので一部に独自の記法が存在します。 + +## 配列等で index を得るには-index を使う + +https://github.com/samskivert/jmustache#-index + +ここに書いてあるとおりです。