From 6a4d1837f24e8762e1cd47650cdf602fbfb118a2 Mon Sep 17 00:00:00 2001 From: armanddidierjean <95971503+armanddidierjean@users.noreply.github.com> Date: Sat, 19 Jul 2025 20:18:00 +0200 Subject: [PATCH] JSON schema for Settings --- .env.template.yaml | 2 ++ .env.test.yaml | 2 ++ app/core/core_endpoints/endpoints_core.py | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/.env.template.yaml b/.env.template.yaml index 1ae4b420c6..488328e6fe 100644 --- a/.env.template.yaml +++ b/.env.template.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://hyperion.myecl.fr/settings-json-schema.json + ############################################### # Authorization using OAuth or Openid connect # ############################################### diff --git a/.env.test.yaml b/.env.test.yaml index ee5a770ffc..f77a4bc40d 100644 --- a/.env.test.yaml +++ b/.env.test.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://hyperion.myecl.fr/settings-json-schema.json + ########################################################################### # This dotenv file and its values should NEVER be used in PRODUCTION! # ########################################################################### diff --git a/app/core/core_endpoints/endpoints_core.py b/app/core/core_endpoints/endpoints_core.py index abc008f24b..443b8e9df5 100644 --- a/app/core/core_endpoints/endpoints_core.py +++ b/app/core/core_endpoints/endpoints_core.py @@ -311,3 +311,20 @@ async def delete_module_account_type_visibility( allowed_account_type=account_type, db=db, ) + + +@router.get( + "/settings-json-schema.json", + status_code=200, +) +async def get_settings_json_schema(): + """ + Return Settings JSON schema. + + It can be used in vscode: + ```yml + # yaml-language-server: $schema=https://hyperion.myecl.fr/settings-json-schema.json + ``` + """ + + return Settings.model_json_schema()