From 08e19236ff62ae0a432b340fd7642a1c314ac3e4 Mon Sep 17 00:00:00 2001 From: Lars Trieloff Date: Wed, 4 Dec 2019 14:35:56 +0000 Subject: [PATCH] feat(markdown): show id and status in header --- lib/formatInfo.js | 15 +++++++++++++-- lib/markdownBuilder.js | 11 ++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/formatInfo.js b/lib/formatInfo.js index da4debe7..d597fce6 100644 --- a/lib/formatInfo.js +++ b/lib/formatInfo.js @@ -66,12 +66,23 @@ function formatInfo({ extension }) { return schema.definitions !== undefined || schema['meta:extensible'] === true; } + function isidentifiable(schema) { + if (!schema.properties) { + return 'undefined'; + } + if (schema.properties['@id'] && schema.properties['@id'].type === 'string' && schema.properties['@id'].format === 'uri') { + return 'true'; + } else { + return 'false'; + } + } + function formatmeta(schema) { return { abstract: isabstract(schema.schema), extensible: isextensible(schema.schema), - status: undefined, - identifiable: undefined, + status: schema.schema['meta:status'] || undefined, + identifiable: isidentifiable(schema.schema), custom: undefined, additional: undefined, definedin: undefined diff --git a/lib/markdownBuilder.js b/lib/markdownBuilder.js index 7d1170eb..5c989908 100644 --- a/lib/markdownBuilder.js +++ b/lib/markdownBuilder.js @@ -36,8 +36,10 @@ function build({ header, links = {} }) { name: 'status', title: 'Status', undefinedlabel: 'Unknown status', - truelabel: 'Yes', - falselabel: 'No', + deprecatedlabel: 'Deprecated', + stablelabel: 'Stable', + stabilizinglabel: 'Stabilizing', + experimentallabel: 'Experimental', }, { name: 'identifiable', @@ -93,7 +95,10 @@ function build({ header, links = {} }) { (prop) => { // this is a linked property - if (schema.meta && schema.meta[prop.name] && schema.meta[prop.name].link) { + if (schema.meta && + schema.meta[prop.name] && + typeof schema.meta[prop.name] !== 'object' && + typeof schema.meta[prop.name].link === 'string') { return tableCell(link(schema.meta[prop.name].link, '', text(schema.meta[prop.name].text))); } const value = schema.meta ? schema.meta[prop.name] : undefined;