-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(semantic-conventions): bump weaver; use comment filter rather t…
…han deprecated comment_with_prefix (#5100)
- Loading branch information
Showing
8 changed files
with
1,610 additions
and
1,849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 33 additions & 20 deletions
53
scripts/semconv/templates/registry/stable/docstring.ts.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
{% macro strong_reqs(string) -%}{{ string | replace(" MUST ", " **MUST** ") | replace(" MUST NOT ", " **MUST NOT** ") | replace(" SHOULD ", " **SHOULD** ") | replace(" SHOULD NOT ", " **SHOULD NOT** ") | replace(" MAY ", " **MAY** ") | replace(" NOT ", " **NOT** ") }}{% endmacro -%} | ||
{% macro strong_rfc2119(string) -%}{{ string | regex_replace("\\b(MUST NOT|MUST|REQUIRED|SHALL NOT|SHALL|SHOULD NOT|SHOULD|RECOMMENDED|MAY|OPTIONAL)\\b", "**$1**") }}{% endmacro -%} | ||
|
||
{% macro docstring(obj, type="value") -%}/** | ||
{{ strong_reqs(obj.brief | comment_with_prefix(" * ")) }} | ||
{% if obj.examples is sequence %}{% for example in obj.examples %} | ||
* | ||
* @example {{ example }} | ||
{% endfor %}{%elif obj.examples%} | ||
* | ||
* @example {{ obj.examples | print_member_value }} | ||
{% endif %}{% if obj.note %} | ||
* | ||
{{ ("@note " ~ strong_reqs(obj.note)) | comment_with_prefix(" * ") }} | ||
{% endif %}{% if (obj.stability) != "stable" %} | ||
* | ||
* @experimental This {{type}} is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. | ||
{% endif %}{% if obj.deprecated %} | ||
* | ||
* @deprecated {{ strong_reqs(obj.deprecated) | comment_with_prefix(" * ") }} | ||
{% endif %} | ||
*/{% endmacro -%} | ||
{% macro docstring(obj, type="value") -%} | ||
{%- set examples_jsdoc %} | ||
{% if obj.examples is sequence %} | ||
{% for example in obj.examples %} | ||
@example {{ example }} | ||
{% endfor %} | ||
{% elif obj.examples %} | ||
@example {{ obj.examples | print_member_value }} | ||
{% endif %} | ||
{% endset -%} | ||
|
||
{%- if obj.note %} | ||
{% set note_jsdoc = "@note " ~ strong_rfc2119(obj.note) %} | ||
{% endif -%} | ||
|
||
{%- if obj.stability != "stable" %} | ||
{% set stability_jsdoc = "@experimental This " ~ type ~ " is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`." %} | ||
{% endif -%} | ||
|
||
{%- if obj is deprecated %} | ||
{%- set deprecated_jsdoc = "\n@deprecated " ~ strong_rfc2119(obj.deprecated) -%} | ||
{%- endif -%} | ||
|
||
{{ [ | ||
strong_rfc2119(obj.brief) | trim, | ||
"\n", | ||
examples_jsdoc, | ||
note_jsdoc, | ||
stability_jsdoc, | ||
deprecated_jsdoc, | ||
] | comment }} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.