Repository: FHIR/sushi (ts)

Issue:
Remove warning about inline extensions
When someone uses an inline extension which has the same name/id as an externally defined extension, SUSHI emits a warning similar to:
```
 Extension with slice name 'period' will be treated as an inline extension, even though the name can be resolved to the external extension: http://hl7.org/fhir/StructureDefinition/organization-period. Starting with SUSHI 0.10.0, extension slices using standalone extensions should explicitly declare a slice name and type. If this extension slice should refer to http://hl7.org/fhir/StructureDefinition/organization-period, recommended practice is to define an alias:
  Alias: PeriodExtension = http://hl7.org/fhir/StructureDefinition/organization-period
then use it in the contains rule:
  extension contains PeriodExtension named period 0..1
If this extension is intended to be inlined, and not refer to http://hl7.org/fhir/StructureDefinition/organization-period, then no action is necessary. This warning will be removed in a future version of SUSHI after authors have had time to transition.
```
That warning was added in SUSHI 0.10.0 on March 7th, so it has been over 2 months. I'd say it may be time we lose the warning.

Pull request description:
No longer issue a warning if an inline extension name resolves
No longer issue a warning if an inline extension name resolves to an external definition

This warning was intended to be temporary.  Time has passed, so we are removing it now.

To test this manually, add this rule to any FSH profile:
```
* extension contains language 0..1
```

On the master branch, you'll get a gigantic warning.  On this PR's branch, you won't get any warning.

Fixes #456.

Patch:
diff --git a/src/export/StructureDefinitionExporter.ts b/src/export/StructureDefinitionExporter.ts
index 3dba7f5..27efd06 100644
--- a/src/export/StructureDefinitionExporter.ts
+++ b/src/export/StructureDefinitionExporter.ts
@@ -1,4 +1,3 @@
-import { upperFirst, words } from 'lodash';
 import {
   StructureDefinition,
   ElementDefinition,
@@ -235,61 +234,6 @@ export class StructureDefinitionExporter implements Fishable {
         }
         slice.type[0].profile.push(extension.url);
       } else {
-        const external = this.fishForMetadata(item.name, Type.Extension);
-        if (external) {
-          // Log a warning. This is intended to help users transitioning from SUSHI 0.9.x to SUSHI 0.10.0,
-          // since the syntax for specifying external extensions has changed.
-          // First find the corresponding card rule to assist in constructing the warning message
-          let card = 'm..n';
-          const cardRule = fshDefinition.rules.find(
-            r => r instanceof CardRule && r.path === `${rule.path}[${item.name}]`
-          );
-          if (cardRule) {
-            card = `${(cardRule as CardRule).min}..${(cardRule as CardRule).max}`;
-          }
-          // Customize the message based on whether or not extension comes from the tank
-          const fshMeta = this.tank.fishForMetadata(item.name);
-          if (fshMeta && fshMeta.url === external.url) {
-            // For the suggestion, create an alternate slice name to consider.
-            // E.g. TimeOfDay --> time-of-day, or time-of-day --> time-of-day-ext
-            let altSliceName = words(fshMeta.name).join('-').toLowerCase();
-            if (altSliceName === fshMeta.name) {
-              altSliceName += '-ext';
-            }
-            logger.warn(
-              `Extension with slice name '${item.name}' will be treated as an inline extension, even ` +
-                'though the name can be resolved to an extension defined in the FSH Tank. Starting with ' +
-                'SUSHI 0.10.0, extension slices using standalone extensions should explicitly declare a ' +
-                `slice name and type. If this extension slice should refer to the ${fshMeta.name} ` +
-                `extension (${fshMeta.url}), specify both the slice name and extension name in the ` +
-                'contains rule:\n' +
-                `  ${rule.path} contains ${fshMeta.name} named ${item.name} ${card}\n` +
-                'If you wish, you can give the slice name a different name than the FSH extension name. ' +
-                'For example:\n' +
-                `  ${rule.path} contains ${fshMeta.name} named ${altSliceName} ${card}\n` +
-                'If this extension is intended to be inlined, and not refer to the standalone ' +
-                `${fshMeta.name} extension, then no action is necessary. This warning will be removed in ` +
-                'a future version of SUSHI after authors have had time to transition.',
-              rule.sourceInfo
-            );
-          } else {
-            const alias = upperFirst(external.name ?? external.id) + 'Extension';
-            logger.warn(
-              `Extension with slice name '${item.name}' will be treated as an inline extension, even ` +
-                `though the name can be resolved to the external extension: ${external.url}. Starting ` +
-                'with SUSHI 0.10.0, extension slices using standalone extensions should explicitly ' +
-                `declare a slice name and type. If this extension slice should refer to ${external.url}, ` +
-                'recommended practice is to define an alias:\n' +
-                `  Alias: ${alias} = ${external.url}\n` +
-                'then use it in the contains rule:\n' +
-                `  ${rule.path} contains ${alias} named ${item.name} ${card}\n` +
-                `If this extension is intended to be inlined, and not refer to ${external.url}, then no ` +
-                'action is necessary. This warning will be removed in a future version of SUSHI after ' +
-                'authors have had time to transition.',
-              rule.sourceInfo
-            );
-          }
-        }
         // If the extension is inline, fix its url element automatically to the sliceName
         const slice = element.addSlice(item.name);
         const urlElement = structDef.findElementByPath(


Test patch:
diff --git a/test/export/StructureDefinitionExporter.test.ts b/test/export/StructureDefinitionExporter.test.ts
index 577edbb..1cb5868 100644
--- a/test/export/StructureDefinitionExporter.test.ts
+++ b/test/export/StructureDefinitionExporter.test.ts
@@ -1991,10 +1991,10 @@ describe('StructureDefinitionExporter', () => {
     expect(loggerSpy.getLastMessage()).toMatch(/File: NoSlice\.fsh.*Line: 6\D*/s);
   });
 
-  // Since previous versions of SUSHI used the slicename as a type lookup as well, we want to issue a warning when we
-  // find a rule that may have been intended to work that way (essentially, a user who has not updated their fsh).
-  // We expect to remove this warning at some point since it is only needed in the transition.
-  it('should report a warning if the extension slice name resolves to an external extension type and no explicit type was specified', () => {
+  // Since previous versions of SUSHI used the slicename as a type lookup as well, we used to issue a warning when we
+  // found a rule that may have been intended to work that way (essentially, a user who has not updated their fsh).
+  // Time has passed since then and we no longer issue that warning.  This test proves that.
+  it('should NOT report a warning if the extension slice name resolves to an external extension type and no explicit type was specified', () => {
     const profile = new Profile('Foo');
     profile.parent = 'Observation';
 
@@ -2022,12 +2022,11 @@ describe('StructureDefinitionExporter', () => {
     expect(extensionSliceUrl).toBeDefined();
     expect(extensionSliceUrl.fixedUri).toBe('maxSize');
 
-    expect(loggerSpy.getLastMessage('warn')).toMatch(
-      /Alias: MaxSizeExtension = http:\/\/hl7\.org\/fhir\/StructureDefinition\/maxSize.*extension contains MaxSizeExtension named maxSize 0\.\.1.*File: ExternalSliceName\.fsh.*Line: 6\D*/s
-    );
+    // In previous versions of this test, a warning was expected here
+    expect(loggerSpy.getAllLogs('warn').length).toBe(0);
   });
 
-  it('should report a warning if the extension slice name resolves to a FSH extension and no explicit type was specified', () => {
+  it('should NOT report a warning if the extension slice name resolves to a FSH extension and no explicit type was specified', () => {
     const extension = new Extension('MyFshExtension');
     const extCardRule = new CardRule('extension');
     extCardRule.min = 0;
@@ -2064,9 +2063,8 @@ describe('StructureDefinitionExporter', () => {
     expect(extensionSliceUrl).toBeDefined();
     expect(extensionSliceUrl.fixedUri).toBe('MyFshExtension');
 
-    expect(loggerSpy.getLastMessage('warn')).toMatch(
-      /extension contains MyFshExtension named MyFshExtension 0\.\.1.*extension contains MyFshExtension named my-fsh-extension 0\.\.1.*File: FSHSliceName\.fsh.*Line: 6\D*/s
-    );
+    // In previous versions of this test, a warning was expected here
+    expect(loggerSpy.getAllLogs('warn').length).toBe(0);
   });
 
   it('should not report a warning if the extension slice name resolves to an extension type but explicit type was specified', () => {