Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tools/dgeni/common/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,19 @@ export function getBreakingChange(doc: ApiDoc): string | null {
return breakingChange ? breakingChange.description : null;
}

export function getDeprecationMessage(doc: ApiDoc): string | null {
const deprecatedMessage = findJsDocTag(doc, 'deprecated');
return deprecatedMessage ? deprecatedMessage.description : null;
}

/**
* Decorates public exposed docs. Creates a property on the doc that indicates whether
* the item is deprecated or not.
* the item is deprecated or not and set deprecation message.
*/
export function decorateDeprecatedDoc(doc: ApiDoc & DeprecationInfo) {
doc.isDeprecated = isDeprecatedDoc(doc);
doc.breakingChange = getBreakingChange(doc);
doc.deprecatedMessage = getDeprecationMessage(doc);

if (doc.isDeprecated && !doc.breakingChange) {
console.warn('Warning: There is a deprecated item without a @breaking-change tag.', doc.id);
Expand Down
1 change: 1 addition & 0 deletions tools/dgeni/common/dgeni-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {NormalizedFunctionParameters} from './normalize-function-parameters';
export interface DeprecationInfo {
isDeprecated: boolean;
breakingChange: string | null;
deprecatedMessage: string | null;
}

/** Interface that describes Dgeni documents that have decorators. */
Expand Down
6 changes: 4 additions & 2 deletions tools/dgeni/templates/macros.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% macro deprecationTitle(doc) %}
{%- if doc.breakingChange -%}
title="Will be removed in v{$ doc.breakingChange $} or later"
{%- if doc.breakingChange and doc.deprecatedMessage -%}
deprecated-message="{$ doc.deprecatedMessage $} Will be removed in v{$ doc.breakingChange $} or later."
{% else %}
deprecated-message="{$ doc.deprecatedMessage $}"
{%- endif -%}
{% endmacro %}
Loading