Page MenuHomePhabricator

The error message of TemplateData is not descriptive
Closed, ResolvedPublicBUG REPORT

Description

When there is some syntax error in the JSON, it only tells me that "JSON contains syntax errors". But it does not say what errors exist, not the row and position of the error.

Besides, if I have some duplicate or lack some properties, it only sais "Required property paramOrder[82] not found". It does not say what property (the name of the property) not found, which is very confusing.

图片.png (129×453 px, 13 KB)

Here is the templatedata attached:

{
	"params": {
		"box_width": {
			"description": "整个信息框的宽度",
			"type": "string"
		},
		"name": {
			"label": "名稱",
			"default": "{{PAGENAME}}",
			"required": true,
			"description": "系统名称",
			"type": "content"
		},
		"native_name": {
			"label": "原文名稱",
			"description": "原文名稱或英文名稱",
			"aliases": [
				"nativename"
			]
		},
		"logo_padding": {
			"label": "标志衬距",
			"description": "铁路图标的衬距。",
			"example": "3px",
			"type": "string"
		},
		"logo": {
			"label": "標志",
			"description": "标志档案名称,已使用[[模块:InfoboxImage]],与格式[[File:文件名]]兼容,可自行指定大小。 ",
			"aliases": [
				"logo_filename"
			],
			"type": "wiki-file-name"
		},
		"logo_size": {
			"label": "標志大小",
			"description": "設定標志的大小",
			"aliases": [
				"logosize"
			],
			"example": "20px",
			"type": "string",
			"default": "200px"
		},
		"logo_alt": {
			"label": "标志替代文本",
			"description": "用于图标的替代文本,供辅助功能使用。",
			"type": "content"
		},
		"logo_caption": {
			"label": "標志説明",
			"description": "標志下方的説明文字",
			"type": "content"
		},
		"image": {
			"label": "圖像",
			"aliases": [
				"Image"
			],
			"description": "图像。请使用image参数名称,不建议使用已弃用的Image。",
			"type": "wiki-file-name"
		},
		"image_size": {
			"label": "圖像大小",
			"description": "設定圖像大小",
			"aliases": [
				"imagesize"
			],
			"example": "200px",
			"type": "string"
		},
		"image_alt": {
			"aliases": [
				"alt"
			],
			"label": "图像替代文字",
			"description": "图像的替代文本,用于辅助功能。",
			"type": "content"
		},
		"image_caption": {
			"label": "圖像説明",
			"description": "圖像下方的説明文字",
			"aliases": [
				"image_caption",
				"caption",
				"Caption"
			],
			"type": "content"
		},
		"image2": {
			"label": "次要圖像",
			"type": "wiki-file-name"
		},
		"image_size2": {
			"label": "次要图像大小",
			"description": "次要图像的大小。",
			"example": "200px",
			"type": "string"
		},
		"image_alt2": {
			"aliases": [
				"alt2"
			],
			"label": "次要图像替代文本",
			"description": "次要图像的替代文本,用于辅助功能。",
			"type": "content"
		},
		"image_caption2": {
			"label": "次要圖像大小",
			"description": "設定次要圖像大小"
		},
		"owner": {
			"label": "所有者",
			"description": "系統的所有者",
			"aliases": [
				"propietaire",
				"Propietaire",
				"parent"
			],
			"type": "content"
		},
		"locale": {
			"label": "地區",
			"description": "系统所在的都市或地区。此参数与siege/Siege互斥。使用此参数时将表示地区,siege表示城市。",
			"type": "content"
		},
		"lines": {
			"label": "綫路",
			"aliases": [
				"routes",
				"route"
			],
			"description": "线路。",
			"type": "content"
		},
		"line_number": {
			"label": "线路编号",
			"description": "线路编号,与waterway/crosses参数互斥。",
			"type": "content"
		},
		"stations": {
			"label": "車站",
			"description": "车站,与stations_amount参数互斥。",
			"type": "content"
		},
		"annual_ridership": {
			"label": "年客運量",
			"aliases": [
				"annual_passengers",
				"annpassengers",
				"AnnPassengers",
				"annual ridership",
				"AnnualPassengers",
				"yearly_ridership",
				"ridershipyear"
			],
			"type": "content"
		},
		"chief_executive": {
			"aliases": [
				"ceo"
			],
			"label": "行政總裁",
			"type": "content"
		},
		"key_people": {
			"label": "关键人物",
			"type": "content"
		},
		"website": {
			"label": "網站",
			"type": "url"
		},
		"weekly_ridership": {
			"label": "周客運量",
			"type": "content"
		},
		"began_operation": {
			"label": "開始運營",
			"aliases": [
				"year_opened",
				"yearopened",
				"YearOpened",
				"start_year",
				"commenced",
				"opened"
			],
			"description": "开始运营的日期。",
			"type": "content"
		},
		"operation_will_start": {
			"label": "预定开通",
			"type": "content",
			"description": "未来开始营运日期。"
		},
		"ended_operation": {
			"label": "結束運營",
			"aliases": [
				"out_of_service",
				"end_year",
				"ceased",
				"closed"
			],
			"type": "content"
		},
		"operator": {
			"label": "運營商",
			"aliases": [
				"运营商",
				"營運商",
				"Operator"
			],
			"type": "content"
		},
		"marks": {
			"aliases": [
				"reporting marks"
			],
			"label": "标识"
		},
		"host": {
			"label": "擁有產權鐵路",
			"type": "content"
		},
		"character": {
			"label": "线路类型",
			"aliases": [
				"DeepOrSurface"
			],
			"description": "线路类型。“线路/路线”一词可通过route_title参数替代。",
			"type": "content"
		},
		"vehicles": {
			"label": "车辆总数",
			"description": "车辆总数,与vessels/ferries参数互斥。",
			"type": "content"
		},
		"train_length": {
			"label": "列車長度",
			"type": "content"
		},
		"headway": {
			"aliases": [
				"frequency"
			],
			"label": "班次",
			"description": "间隔时间",
			"type": "content"
		},
		"route_title": {
			"label": "路线类型显示名称",
			"description": "如指定,则替代标签中“路线类型/线路类型”中的“路线/线路”一词。",
			"type": "unbalanced-wikitext",
			"default": "-{zh-cn:线路;zh-tw:路線;}-"
		},
		"system_length": {
			"label": "系統長度",
			"description": "系统长度,与length/LengthMiles等参数互斥。",
			"type": "content"
		},
		"notrack": {
			"label": "轨道总数",
			"type": "content"
		},
		"track_gauge": {
			"label": "軌距",
			"aliases": [
				"gauge"
			],
			"type": "content"
		},
		"ogauge": {
			"label": "過去軌距",
			"type": "content"
		},
		"minimum_radius_of_curvature": {
			"label": "最小曲線半徑/转弯半径",
			"type": "content"
		},
		"average_speed": {
			"label": "平均速度",
			"type": "content"
		},
		"top_speed": {
			"label": "最高速度",
			"type": "content"
		},
		"electrification": {
			"label": "動力方式",
			"aliases": [
				"el"
			],
			"type": "content",
			"description": "架空电缆 or 第三轨供电, 电压, 直流 or 交流, 等等. "
		},
		"map": {
			"label": "系統地圖",
			"aliases": [
				"system_map"
			],
			"type": "content"
		},
		"map_state": {
			"label": "系統顯示狀態",
			"description": "显示或隐藏地图,请使用 show(显示)或 collapsed(隐藏)",
			"type": "string",
			"suggestedvalues": [
				"show",
				"collapsed"
			]
		},
		"map_name": {
			"label": "地圖名稱",
			"default": "系統地圖",
			"aliases": [
				"map_caption"
			],
			"description": "显示在地图上方的名称。",
			"type": "content"
		},
		"headquarters": {
			"label": "總部",
			"description": "系統總部位置",
			"suggested": true,
			"aliases": [
				"hq",
				"hq_city"
			],
			"type": "content"
		},
		"native_name_lang": {
			"label": "原文名称语言",
			"description": "原文名称的语言。",
			"example": "en",
			"type": "string",
			"default": "en",
			"deprecated": "建议直接使用{{lang}}模板。"
		},
		"Line": {
			"label": "伦敦铁路线路名",
			"description": "伦敦铁路的线路名称,当指定了此值时,一些参数会自动将其视为伦敦铁路。",
			"type": "content",
			"deprecated": true
		},
		"manager": {
			"label": "管理機關",
			"type": "content"
		},
		"siege": {
			"aliases": [
				"Siege"
			],
			"label": "城市",
			"type": "content"
		},
		"area served": {
			"aliases": [
				"villes",
				"Villes",
				"service_area"
			],
			"label": "服務區域",
			"type": "content"
		},
		"transit_type": {
			"aliases": [
				"type",
				"systeme",
				"Systeme",
				"service_type",
				"transit_type",
				"ferrytype"
			],
			"label": "交通类型",
			"description": "运输系统类型。",
			"example": "[[城市轨道交通]]",
			"type": "content"
		},
		"waterway": {
			"aliases": [
				"crosses"
			],
			"label": "航道",
			"description": "航道,与line_number参数互斥。",
			"type": "content"
		},
		"start": {
			"label": "起点",
			"type": "content"
		},
		"end": {
			"label": "终点",
			"type": "content"
		},
		"station_amount": {
			"aliases": [
				"stationamount",
				"StationAmount",
				"StationsServed"
			],
			"label": "车站数量",
			"description": "车站数量,与stations参数互斥。",
			"type": "content"
		},
		"intermediate": {
			"aliases": [
				"via"
			],
			"label": "途经",
			"description": "与stops参数互斥。",
			"type": "content"
		},
		"stops": {
			"label": "停靠站",
			"type": "content"
		},
		"average_interstation": {
			"aliases": [
				"aveinterstation",
				"AveInterstation"
			],
			"label": "平均站距",
			"description": "会自动应用{{convert}}模板。",
			"type": "string"
		},
		"destinations": {
			"label": "目的地",
			"type": "content"
		},
		"hubs": {
			"label": "枢纽"
		},
		"fare": {
			"label": "收费",
			"type": "content"
		},
		"ridership": {
			"aliases": [
				"daily_ridership",
				"ridershipday"
			],
			"label": "日客运量",
			"type": "content"
		},
		"alliance": {
			"label": "聯營",
			"type": "content"
		},
		"connection": {
			"aliases": [
				"connexion",
				"Connexion"
			],
			"label": "可連接系統",
			"type": "content"
		},
		"leader": {
			"label": "经理",
			"description": "经理,其“经理”二字可通过leader_type参数更改。",
			"type": "content"
		},
		"leader_type": {
			"label": "管理者类型",
			"description": "如果指定,则替换“经理”二字。",
			"type": "content",
			"default": "经理"
		},
		"company_slogan": {
			"label": "標語口号"
		},
		"founded": {
			"label": "成立",
			"type": "content"
		},
		"defunct": {
			"label": "结束",
			"type": "content"
		},
		"service": {
			"aliases": [
				"Service"
			],
			"label": "运营日",
			"type": "content"
		},
		"predecessor_line": {
			"aliases": [
				"predecessor"
			],
			"label": "前身线路",
			"type": "content"
		},
		"successor_line": {
			"aliases": [
				"successor"
			],
			"label": "后继线路"
		},
		"vessels": {
			"aliases": [
				"ferries"
			],
			"label": "船只总数",
			"description": "船只总数,与vehicles参数互斥。"
		},
		"rolling_stock": {
			"aliases": [
				"rollingstock",
				"RollingStock"
			],
			"label": "车型",
			"description": "车型,与fleet参数互斥。",
			"type": "content"
		},
		"fleet": {
			"label": "车队",
			"description": "车队,与rolling_stock参数互斥。",
			"type": "content"
		},
		"depot": {
			"aliases": [
				"Depot",
				"depots",
				"Depots"
			],
			"label": "车厂",
			"type": "content"
		},
		"lounge": {
			"label": "休息室",
			"type": "content"
		},
		"length": {
			"aliases": [
				"Length",
				"LengthKm"
			],
			"label": "系统长度(千米)",
			"description": "系统长度,会自动通过{{convert}}模板转换为千米。",
			"type": "string"
		},
		"LengthMiles": {
			"label": "系统长度(英里)",
			"description": "系统长度,会自动通过{{convert}}模板转换为英里。",
			"type": "string"
		},
		"fuel_type": {
			"label": "燃料类型",
			"description": "燃料类型,与el/electrification参数互斥。",
			"type": "content"
		},
		"duration": {
			"aliases": [
				"traveltime"
			],
			"label": "全程所需时间",
			"type": "content"
		},
		"bgcolor": {
			"label": "背景颜色",
			"description": "顶部名称的背景颜色。如指定了Line(非line)参数,则无效。",
			"example": "yellow",
			"type": "string"
		},
		"color": {
			"aliases": [
				"TextColour"
			],
			"label": "文本颜色",
			"description": "顶部的文本颜色。",
			"type": "string",
			"suggestedvalues": [
				"blue"
			]
		}
	},
	"paramOrder": [
		"box_width",
		"name",
		"bgcolor",
		"color",
		"native_name",
		"native_name_lang",
		"logo_padding",
		"logo",
		"logo_size",
		"logo_alt",
		"logo_caption",
		"image",
		"image_size",
		"image_alt",
		"image_caption",
		"image2",
		"image_size2",
		"image_alt2",
		"image_caption2",
		"owner",
		"manager",
		"locale",
		"siege",
		"area served",
		"transit_type",
		"waterway",
		"line_number",
		"lines",
		"start",
		"end",
		"stations",
		"station_amount",
		"intermediate",
		"stops",
		"average_interstation",
		"destinations",
		"hubs",
		"fare",
		"ridership",
		"weekly_ridership",
		"annual_ridership",
		"alliance",
		"connection",
		"chief_executive",
		"leader_type",
		"leader",
		"key_people",
		"headquarters",
		"company_slogan",
		"website",
		"founded",
		"began_operation",
		"operation_will_start",
		"ended_operation",
		"defunct",
		"service",
		"headway",
		"operator",
		"marks",
		"host",
		"route_title",
		"character",
		"predecessor_line",
		"successor_line",
		"vessels",
		"vehicles",
		"rolling_stock",
		"fleet",
		"train_length",
		"depot",
		"lounge",
		"system_length",
		"notrack",
		"track_gauge",
		"ogauge",
		"minimum_radius_of_curvature",
		"average_speed",
		"top_speed",
		"electrification",
		"map",
		"map_state",
		"map_name"
	],
	"description": "这模板主要用于轨道运输。 ",
	"format": "block"
}

Event Timeline

Change 951076 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Show much more actionable context when paramOrder is incomplete

https://gerrit.wikimedia.org/r/951076

Change 951076 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Show much more actionable context when paramOrder is incomplete

https://gerrit.wikimedia.org/r/951076

Boro claimed this task.
Boro subscribed.

This ticket has two tasks. The one with the paramorder was resolved as noted. The other on non-descriptive JSON syntax errors is a duplicate of T52511.

Boro removed Boro as the assignee of this task.Oct 17 2025, 7:55 PM