Repository: garmeeh/next-seo (js)

Issue:
No worstRating under AggregateRating json ld
**Describe the bug**
No worstRating under AggregateRating json ld

**Reproduction**
Based on ld json schema, AggregateRating should have worstRating which is missing next-seo

Schema:
https://schema.org/AggregateRating

Github for next-seo types missing worstRating
https://github.com/garmeeh/next-seo/blob/d96d58dc093d0cdf5f24e059e509ae6234b353cc/src/types.ts#L350

**Expected behavior**
worstRating under AgggregateRating


**Additional context**
none


Pull request description:
fix: #1118 - added worstRating under AggregateRating type
## Description of Change(s):

Fixes #1118 
- Added worstRating under AggregateRating type & schema. Also added in tests & documentation.

---

To help get PR's merged faster, the following is required:

[] Updated the documentation
[] Unit/Cypress test covering all cases

Please link to relevant Google Docs or schema.org docs for what you are adding so we can review.

Please have a read of the Contributing Guide for full details.

https://github.com/garmeeh/next-seo/blob/master/CONTRIBUTING.md


Patch:
diff --git a/README.md b/README.md
index 96140b0..6296527 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 **Have you seen the new Next.js newsletter?**
 
-[<img alt="NextjsWeekly banner" src="./next-js-weekly.png">](https://nextjsweekly.com?utm_source=next-seo)
+[<img alt="NextjsWeekly banner" src="./next-js-weekly.png">](https://dub.sh/nextjsweekly)
 
 # Next SEO
 
@@ -1081,7 +1081,7 @@ Next SEO now has the ability to set JSON-LD a form of structured data. Structure
 
 Google has excellent content on JSON-LD -> [HERE](https://developers.google.com/search/docs/data-types/article)
 
-**If using app directory then please ensure to add `useAppDir={false}` prop and that you are using the component in the `page.js`**
+**If using app directory then please ensure to add `useAppDir={true}` prop and that you are using the component in the `page.js`**
 
 Below you will find a very basic page implementing each of the available JSON-LD types:
 
@@ -2255,6 +2255,7 @@ const Page = () => (
         reviewCount: '89',
         ratingCount: '684',
         bestRating: '100',
+        worstRating: '1',
       }}
       reviews={[
         {
@@ -3177,6 +3178,7 @@ export default () => (
 | `aggregateRating.ratingCount` | The count of total number of ratings.                                                    |
 | `aggregateRating.reviewCount` | The count of total number of reviews.                                                    |
 | `aggregateRating.bestRating`  | The highest value allowed in this rating system. If bestRating is omitted, 5 is assumed. |
+| `aggregateRating.worstRating` | The lowest value allowed in this rating system. If worstRating is omitted, 1 is assumed. |
 
 **Other**
 | `useAppDir` | This should be set to true if using new app directory. Not required if outside of app directory. |
diff --git a/src/jsonld/jobPosting.tsx b/src/jsonld/jobPosting.tsx
index 6170e5c..de9cb6e 100644
--- a/src/jsonld/jobPosting.tsx
+++ b/src/jsonld/jobPosting.tsx
@@ -9,10 +9,10 @@ export interface HiringOrganization {
 }
 
 export interface Place {
-  addressLocality: string;
-  addressRegion: string;
-  postalCode: string;
-  streetAddress: string;
+  addressLocality?: string;
+  addressRegion?: string;
+  postalCode?: string;
+  streetAddress?: string;
   addressCountry: string;
 }
 
diff --git a/src/types.ts b/src/types.ts
index a92f362..c333741 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -359,6 +359,7 @@ export type AggregateRating = {
   reviewCount?: string;
   ratingCount?: string;
   bestRating?: string;
+  worstRating?: string;
 };
 
 export type GamePlayMode = 'CoOp' | 'MultiPlayer' | 'SinglePlayer';
diff --git a/src/utils/schema/setAggregateRating.ts b/src/utils/schema/setAggregateRating.ts
index 31b1b72..72553c1 100644
--- a/src/utils/schema/setAggregateRating.ts
+++ b/src/utils/schema/setAggregateRating.ts
@@ -8,6 +8,7 @@ export function setAggregateRating(aggregateRating?: AggregateRating) {
       reviewCount: aggregateRating.reviewCount,
       bestRating: aggregateRating.bestRating,
       ratingValue: aggregateRating.ratingValue,
+      worstRating: aggregateRating.worstRating,
     };
   }
   return undefined;


Test patch:
diff --git a/src/utils/schema/__tests__/setAggregateRating.test.ts b/src/utils/schema/__tests__/setAggregateRating.test.ts
index 5820e2e..bc620f0 100644
--- a/src/utils/schema/__tests__/setAggregateRating.test.ts
+++ b/src/utils/schema/__tests__/setAggregateRating.test.ts
@@ -6,6 +6,7 @@ const aggregateRating: AggregateRating = {
   reviewCount: '100',
   ratingCount: '100',
   bestRating: '5',
+  worstRating: '1',
 };
 
 describe('setAggregateOffer', () => {