Skip to content

fix: add missing fields and concrete types to Entity definitions#136

Merged
mmktomato merged 7 commits into
nulab:masterfrom
lollipop-onl:fix/missing-types
Mar 23, 2026
Merged

fix: add missing fields and concrete types to Entity definitions#136
mmktomato merged 7 commits into
nulab:masterfrom
lollipop-onl:fix/missing-types

Conversation

@lollipop-onl
Copy link
Copy Markdown
Contributor

Regarding the type definitions in entity.ts, I will add missing fields based on a comparison with the actual API responses.

Changes

  • Added missing fields:
    • User, DiskUsage, PullRequest.Comment, Notification, Licence
  • Removed [key: string]: any from Project.CustomField.
  • Removed any from Activity.content.
  • Fixed the type for Issue.customFields.

Breaking changes

  • Since the any types have been changed, type errors may occur in existing code that directly accesses these fields.

lollipop-onl and others added 3 commits March 6, 2026 00:36
Add fields found by comparing with backlog-scala API formatters:
- User: NulabAccount interface, nulabAccount and keyword fields
- DiskUsage: document and pullRequest fields
- PullRequest.Comment: oldBlobId, newBlobId, filePath, position fields
- Notification: repository field
- License: nulabAppsIntegration, issueTemplate, and admin-only fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace CustomField index signature [key: string]: any with specific
  optional properties (min, max, items, allowAddItem, etc.) based on
  Scala CustomFieldWritesImplicits
- Add CustomFieldValue namespace with discriminated union types for
  issue custom field values (fieldTypeId-based discrimination)
- Add Activity content union type (ActivityContent) covering all 17
  content types from Scala ProjectActivityWrites
- Add supporting interfaces: CustomFieldItem, CustomFieldInitialDate,
  CustomFieldValueItem, and various Activity sub-types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PullRequestContent.issue is Option[IssueSnapshot] in the Scala source,
  so it should be PullRequestIssue | null
- Rebuild dist to reflect all type definition changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mmktomato mmktomato self-requested a review March 6, 2026 08:48
@mmktomato mmktomato self-assigned this Mar 6, 2026
@mmktomato
Copy link
Copy Markdown
Member

Added missing fields:
User, DiskUsage, PullRequest.Comment, Notification, Licence

I can't find these changes. Can you check?

@mmktomato
Copy link
Copy Markdown
Member

It looks like these types are based on our internal type definitions. Since backlog-js is a public library, it might be better to align with the official public documentation instead.

For example, the content field in the response of getSpaceActivities isn't fully covered in the pages below. (Issue.customFields as well)

Should we ask the internal section to update these pages to match the actual specs first?

@mmktomato
Copy link
Copy Markdown
Member

@lollipop-onl
I added some comments. Please check them. 🙏

….comment nullable

Add ActivityType enum entries for StatusDeleted(34), DocumentCreated(36),
DocumentUpdated(37), DocumentDeleted(38), IssueMultiCreated(47), and
DocumentMultiCreated(48) that were confirmed via API but missing from the enum.
Fix PullRequestContent.comment to be nullable as the API returns null for
PR creation events (type=18).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lollipop-onl
Copy link
Copy Markdown
Contributor Author

@mmktomato
Thank you for your feedback!

Upon checking regarding the additional properties, I was informed that there are no particular restrictions on what the API returns in its response.
I have also confirmed that all the properties being added this time are actually returned in the real response, so no properties that are not actually sent are included.

lollipop-onl and others added 3 commits March 22, 2026 03:15
Add DocumentCommentCreated(40), DocumentCommentUpdated(41),
DocumentCommentDeleted(42), DocumentCommentReplyCreated(43),
DocumentCommentReplyUpdated(44), DocumentCommentReplyDeleted(45),
and DocumentAttachmentCreated(46) to ActivityType enum.
Fix DocumentUpdated(37) → DocumentDeleted(37) and
DocumentDeleted(38) → DocumentTitleUpdated(38) naming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mmktomato mmktomato merged commit 602151f into nulab:master Mar 23, 2026
@mmktomato
Copy link
Copy Markdown
Member

@lollipop-onl
LGTM!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants