0

所以我目前正在使用扩展选择参数,并为使用模板创建错误页面的作业编写了一个 groovy 脚本。现在,为了保存更改,我有一个 python 脚本,它使用扩展选择参数创建的 parameters.json 文件的内容更新 groovy 脚本的“默认”字段。效果很好,但是我每次都必须接受脚本更改。我想知道是否有办法在我的 groovy 脚本中加载 parameters.json,而不是使用 python 对更新的默认值进行硬编码。

import org.boon.Boon

def jsonEditorOptions = Boon.fromJson(/{
  disable_edit_json: true,
  disable_properties: true,
  no_additional_properties: true,
  disable_collapse: false,
  disable_array_add: false,
  disable_array_delete: false,
  disable_array_reorder: false,
  theme: "bootstrap3",
  iconlib: "bootstrap3",
  schema:
{
  "title": "Error Pages",
  "type": "array",
  "format": "table",
  "uniqueItems": true,
  "items": {
    "type": "object",
    "title": "Page",
    "properties": {
      "Error Code": {
        "type": "string",
        "format": "textarea",
        "options": {"expand_height": true},
        "propertyOrder": 1000
      },
      "Description": {
        "type": "string",
        "format": "textarea",
        "options": {"expand_height": true},
        "propertyOrder": 1050
      },
      "Additional Message": {
        "type": "string",
        "format": "textarea",
        "options": {"expand_height": true},
        "propertyOrder": 1100
      }
    }
  },
  "default": 
  [
    {
         "Additional Message": "We're sorry, we can't find the page you're looking for. It might have been removed, changed its name, or it is otherwise unavailable.",
         "Description":"Page Not Found",
         "Error Code":"404"
    },
    {
         "Additional Message":"testMessage",
         "Description":"testDesc",
         "Error Code":"111"
    }
  ]
}/)

有没有类似的东西?

"Default" : ../parameters.json

parameters.json 是主代码段中的 JSON 列表在哪里?

下面是 JSON 的布局,只是为了更清楚:

json表

4

0 回答 0