JHIPSTER一覧

JHIPSTER本家のOPENAPIの説明

https://www.jhipster.tech/doing-api-first-development/

jhipsterのapi.ymlの場所

src/main/resources/swagger/api.yml

サンプルAPI

デフォルトでは、セキュリティに関する記述はあるが何もAPIが記載されていない。

なので、以下のコードをapi.ymlに追加して確認するとする

 /health:
   get:
     operationId: openapitutorial.controller.health.call
     summary: サーバーの状態を返します
     description: サーバーの状態を返します。
     responses:
       '200':
         description: サーバーは正常に動作しています
         content:
           application/json:
             schema:
               $ref: '#/components/schemas/get_health_response'
components:
 schemas:
   get_health_response:
     description: サーバーの状態のレスポンス
     type: object
     properties:
       status:
         type: string
         enum:
           - ok
     required:
       - status  

おもったこと

個人的には、getメソッドとpostメソッドなど、swaggerのアノテーションを付ける箇所は

自動的に生成すればいいのにと思う。

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS