Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pacmak): label "External" stability as "Stable" #1633

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions packages/jsii-calc/lib/stability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,37 @@ export enum DeprecatedEnum {
/** @deprecated option B is kinda bad, too */
OPTION_B
}

/** @external */
export interface ExternalStruct {
/** @external */
readonly readonlyProperty: string;
}
/** @external */
export interface IExternalInterface {
/** @external */
mutableProperty?: number;
/** @external */
method(): void;
}
/** @external */
export class ExternalClass {
/** @external */
public readonly readonlyProperty: string = 'wazoo';
/** @external */
public mutableProperty?: number;
/** @external */
constructor(readonlyString: string, mutableNumber?: number) {
this.readonlyProperty = readonlyString;
this.mutableProperty = mutableNumber;
}
/** @external */
public method(): void { return; }
}
/** @external */
export enum ExternalEnum {
/** @external */
OPTION_A,
/** @external */
OPTION_B
}
217 changes: 216 additions & 1 deletion packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -4455,6 +4455,169 @@
}
]
},
"jsii-calc.ExternalClass": {
"assembly": "jsii-calc",
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"fqn": "jsii-calc.ExternalClass",
"initializer": {
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"parameters": [
{
"name": "readonlyString",
"type": {
"primitive": "string"
}
},
{
"name": "mutableNumber",
"optional": true,
"type": {
"primitive": "number"
}
}
]
},
"kind": "class",
"locationInModule": {
"filename": "lib/stability.ts",
"line": 119
},
"methods": [
{
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/stability.ts",
"line": 130
},
"name": "method"
}
],
"name": "ExternalClass",
"properties": [
{
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/stability.ts",
"line": 121
},
"name": "readonlyProperty",
"type": {
"primitive": "string"
}
},
{
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/stability.ts",
"line": 123
},
"name": "mutableProperty",
"optional": true,
"type": {
"primitive": "number"
}
}
]
},
"jsii-calc.ExternalEnum": {
"assembly": "jsii-calc",
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"fqn": "jsii-calc.ExternalEnum",
"kind": "enum",
"locationInModule": {
"filename": "lib/stability.ts",
"line": 133
},
"members": [
{
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"name": "OPTION_A"
},
{
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"name": "OPTION_B"
}
],
"name": "ExternalEnum"
},
"jsii-calc.ExternalStruct": {
"assembly": "jsii-calc",
"datatype": true,
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"fqn": "jsii-calc.ExternalStruct",
"kind": "interface",
"locationInModule": {
"filename": "lib/stability.ts",
"line": 107
},
"name": "ExternalStruct",
"properties": [
{
"abstract": true,
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/stability.ts",
"line": 109
},
"name": "readonlyProperty",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.GiveMeStructs": {
"assembly": "jsii-calc",
"docs": {
Expand Down Expand Up @@ -4992,6 +5155,58 @@
}
]
},
"jsii-calc.IExternalInterface": {
"assembly": "jsii-calc",
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"fqn": "jsii-calc.IExternalInterface",
"kind": "interface",
"locationInModule": {
"filename": "lib/stability.ts",
"line": 112
},
"methods": [
{
"abstract": true,
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/stability.ts",
"line": 116
},
"name": "method"
}
],
"name": "IExternalInterface",
"properties": [
{
"abstract": true,
"docs": {
"custom": {
"external": "true"
},
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/stability.ts",
"line": 114
},
"name": "mutableProperty",
"optional": true,
"type": {
"primitive": "number"
}
}
]
},
"jsii-calc.IFriendlier": {
"assembly": "jsii-calc",
"docs": {
Expand Down Expand Up @@ -12585,5 +12800,5 @@
}
},
"version": "0.0.0",
"fingerprint": "DX1QMQgQSTuLzsXpnv5YcFSvPRw/30xHOP5U+5pQY0o="
"fingerprint": "sBk+g8M/UxDdbco/a9UXJtumXd2eCRRLsERa1ajaJvo="
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class DotNetDocGenerator {
// All the "tags" need to be rendered with empyt lines between them or they'll be word wrapped.

if (docs.default) { emitDocAttribute('default', docs.default); }
if (docs.stability) { emitDocAttribute('stability', this.nameutils.capitalizeWord(docs.stability)); }
if (docs.stability && shouldMentionStability(docs.stability)) {
emitDocAttribute('stability', this.nameutils.capitalizeWord(docs.stability));
}
if (docs.see) { emitDocAttribute('see', docs.see); }
if (docs.subclassable) { emitDocAttribute('subclassable', ''); }
for (const [k, v] of Object.entries(docs.custom || {})) {
Expand Down Expand Up @@ -167,3 +169,8 @@ export class DotNetDocGenerator {
function ucFirst(x: string) {
return x.substr(0, 1).toUpperCase() + x.substr(1);
}

function shouldMentionStability(s: spec.Stability) {
// Don't render "stable" or "external", those are both stable by implication
return s === spec.Stability.Deprecated || s === spec.Stability.Experimental;
}
4 changes: 3 additions & 1 deletion packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,9 @@ class JavaGenerator extends Generator {
case spec.Stability.Experimental:
return 'Experimental';
case spec.Stability.External:
return 'External';
// Rendering 'External' out as publicly visible state is confusing. As far
// as users are concerned we just advertise this as stable.
return 'Stable';
case spec.Stability.Stable:
return 'Stable';
default:
Expand Down
1 change: 1 addition & 0 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,7 @@ function onelineDescription(docs: spec.Docs | undefined) {
}

function shouldMentionStability(s: Stability) {
// Don't render "stable" or "external", those are both stable by implication.
return s === Stability.Deprecated || s === Stability.Experimental;
}

Expand Down
Loading