Repository: FHIR/sushi (ts)

Issue:
Warning messages about unrecognized configuration properties under "pages" always suggest file type endings
https://chat.fhir.org/#narrow/stream/215610-shorthand/topic/error.20message/near/376451856

```yaml
pages:
  deployment.md:
    Title: Deployment
```
The `title` property should be lowercase, so a warning is emitted. But, since the property path starts with `/pages`, SUSHI emits the warning message `Pages should end with .md, .xml, or .html.`. The property path will need to be checked more carefully to see if that warning message is appropriate.

Pull request description:
Revise warning message for configuration "pages" property
Fixes #1308 and completes task [CIMPL-1144](https://standardhealthrecord.atlassian.net/browse/CIMPL-1144).

An unrecognized property within the "pages" property may or may not represent a subpage. Revise warning message to better acknowledge both possibilities.

Patch:
diff --git a/src/import/importConfiguration.ts b/src/import/importConfiguration.ts
index 71e3365..a2fe6c4 100644
--- a/src/import/importConfiguration.ts
+++ b/src/import/importConfiguration.ts
@@ -915,18 +915,22 @@ function detectPotentialMistakes(yaml: YAMLConfiguration) {
       );
       if (additionalPropertiesErrors.length > 0) {
         const parentProperty = instancePath === '' ? '' : `property ${instancePath.slice(1)} `;
-        const propertyWord = additionalPropertiesErrors.length === 1 ? 'property' : 'properties';
+        const singular = additionalPropertiesErrors.length === 1;
         const additionalPropertyNames = additionalPropertiesErrors
           .map(validationError => validationError.params.additionalProperty)
           .join(', ');
-        let recommendation: string;
+        let recommendation = `Check that ${
+          singular ? 'this property is' : 'these properties are'
+        } spelled, capitalized, and indented correctly.`;
         if (instancePath.startsWith('/pages')) {
-          recommendation = 'Pages should end with .md, .xml, or .html.';
-        } else {
-          recommendation = 'Check that these properties are spelled and indented correctly.';
+          recommendation += ` If ${
+            singular ? 'this is a page, it' : 'these are pages, they'
+          } should end with .md, .xml, or .html.`;
         }
         logger.warn(
-          `Configuration ${parentProperty}contains unexpected ${propertyWord}: ${additionalPropertyNames}. ${recommendation}`
+          `Configuration ${parentProperty}contains unexpected ${
+            singular ? 'property' : 'properties'
+          }: ${additionalPropertyNames}. ${recommendation}`
         );
       } else {
         logger.warn(


Test patch:
diff --git a/test/import/importConfiguration.test.ts b/test/import/importConfiguration.test.ts
index 42cb5f7..fcd020d 100644
--- a/test/import/importConfiguration.test.ts
+++ b/test/import/importConfiguration.test.ts
@@ -469,7 +469,7 @@ describe('importConfiguration', () => {
     expect(actual).toEqual(expected);
     expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
     expect(loggerSpy.getLastMessage('warn')).toMatch(
-      'Configuration contains unexpected property: cookie. Check that these properties are spelled and indented correctly.'
+      'Configuration contains unexpected property: cookie. Check that this property is spelled, capitalized, and indented correctly.'
     );
   });
 
@@ -503,7 +503,7 @@ describe('importConfiguration', () => {
     expect(actual).toEqual(expected);
     expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
     expect(loggerSpy.getLastMessage('warn')).toMatch(
-      'Configuration contains unexpected properties: cookie, index.md. Check that these properties are spelled and indented correctly.'
+      'Configuration contains unexpected properties: cookie, index.md. Check that these properties are spelled, capitalized, and indented correctly.'
     );
   });
 
@@ -2168,7 +2168,7 @@ describe('importConfiguration', () => {
         }
       ]);
       expect(loggerSpy.getLastMessage('warn')).toMatch(
-        'Configuration property pages contains unexpected property: menu. Pages should end with .md, .xml, or .html.'
+        'Configuration property pages contains unexpected property: menu. Check that this property is spelled, capitalized, and indented correctly. If this is a page, it should end with .md, .xml, or .html.'
       );
     });
 
@@ -2202,7 +2202,7 @@ describe('importConfiguration', () => {
         { nameUrl: 'license', page: [] }
       ]);
       expect(loggerSpy.getLastMessage('warn')).toMatch(
-        'Configuration property pages contains unexpected properties: menu, license. Pages should end with .md, .xml, or .html.'
+        'Configuration property pages contains unexpected properties: menu, license. Check that these properties are spelled, capitalized, and indented correctly. If these are pages, they should end with .md, .xml, or .html.'
       );
     });