Skip to content

Commit e04939d

Browse files
authored
Merge pull request #495 from abraham/copilot/remove-grouped-notifications-results
Remove GroupedNotificationsResults special case
2 parents 666689e + 4471da0 commit e04939d

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/__tests__/generators/EntityConverter.grouped-notifications.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { UtilityHelpers } from '../../generators/UtilityHelpers';
44
import { EntityClass } from '../../interfaces/EntityClass';
55
import { OpenAPISpec } from '../../interfaces/OpenAPISchema';
66

7-
describe('EntityConverter - GroupedNotificationsResults Special Case', () => {
7+
describe('EntityConverter - GroupedNotificationsResults', () => {
88
let entityConverter: EntityConverter;
99
let utilityHelpers: UtilityHelpers;
1010
let typeParser: TypeParser;
@@ -39,7 +39,7 @@ describe('EntityConverter - GroupedNotificationsResults Special Case', () => {
3939
attributes: [
4040
{
4141
name: 'notification_groups',
42-
type: '[NotificationGroup]',
42+
type: 'Array of [NotificationGroup]',
4343
description: 'The grouped notifications themselves.',
4444
optional: false,
4545
nullable: true,
@@ -114,7 +114,7 @@ describe('EntityConverter - GroupedNotificationsResults Special Case', () => {
114114
attributes: [
115115
{
116116
name: 'notification_groups',
117-
type: '[NotificationGroup]',
117+
type: 'Array of [NotificationGroup]',
118118
description: 'The grouped notifications themselves.',
119119
optional: false,
120120
nullable: false,

src/generators/EntityConverter.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,6 @@ class EntityConverter {
7373
...entity.attributes,
7474
];
7575
}
76-
} else if (entity.name === 'GroupedNotificationsResults') {
77-
// Special case: notification_groups should be an array of NotificationGroup
78-
// The documentation incorrectly states it's a single NotificationGroup,
79-
// but the actual API returns an array (as shown in the JSON examples).
80-
// This is a known documentation bug that needs to be corrected here.
81-
// See: https://github.com/mastodon/documentation/blob/main/content/en/methods/grouped_notifications.md
82-
allAttributes = entity.attributes.map((attr) => {
83-
if (attr.name === 'notification_groups') {
84-
return {
85-
...attr,
86-
type: 'Array of [NotificationGroup]',
87-
};
88-
}
89-
return attr;
90-
});
9176
}
9277

9378
const schema: OpenAPISchema = {

0 commit comments

Comments
 (0)