Skip to content

Add file types for Modrinth - #119

Merged
modmuss50 merged 7 commits into
modmuss50:mainfrom
srnyx:modrinth-file-types
Jul 29, 2026
Merged

Add file types for Modrinth#119
modmuss50 merged 7 commits into
modmuss50:mainfrom
srnyx:modrinth-file-types

Conversation

@srnyx

@srnyx srnyx commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Currently just detects types automatically without ability to manually set.

Manually setting is a bit difficult, as additional files are a common option, while file types are specific to Modrinth.

A solution is to just have our own defined file types then map them to platform-specific ones. This also means changing additional files to accepting a custom object containing both the file type and file path (default to "unknown" type). The existing additional files option can remain (doesn't need to be deprecated either) and just use the default "unknown" file type.

But for now, this PR is ready as-is for a good start with automatic type associations. Manual setting can always be added later!

Resolves #114

Currently just detects types automatically without ability to manually set.

Manually setting is a bit difficult, as additional files are a common option, while file types are specific to Modrinth.

A solution is to just have our own defined file types then map them to platform-specific ones. This also means changing additional files to accepting a custom object containing both the file type and file path (default "unknown" type).
Copilot AI review requested due to automatic review settings July 3, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Modrinth “file types” support for additional files by including file_types in the create-version metadata and populating it automatically from common filename suffixes (sources/javadoc/dev/signature), with new integration tests validating the mapping.

Changes:

  • Add optional file_types field to ModrinthApi.CreateVersion payload.
  • Populate and send file_types for Modrinth additional uploads based on filename suffix detection.
  • Add integration tests covering expected Modrinth file type mappings (sources/javadoc/dev/signature/unknown).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/test/kotlin/me/modmuss50/mpp/test/modrinth/ModrinthTest.kt Adds integration tests asserting file_types mappings for additional files.
src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/ModrinthApi.kt Extends the Modrinth create-version request model to include file_types.
src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/Modrinth.kt Builds file_types map for additional files and includes it in version creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/Modrinth.kt Outdated
Comment thread src/test/kotlin/me/modmuss50/mpp/test/modrinth/ModrinthTest.kt
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@srnyx

srnyx commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

This works with my testing (https://repo.srnyx.com/#/snapshots/me/modmuss50/mod-publish-plugin)

Comment thread src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/Modrinth.kt Outdated
Comment thread src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/Modrinth.kt Outdated
srnyx added 3 commits July 10, 2026 13:08
To make sure additional files aren't duplicated when specifying them in both publishMods {} and modrinth {} (for file types)
@srnyx
srnyx requested a review from modmuss50 July 12, 2026 17:23
@modmuss50

Copy link
Copy Markdown
Owner

Please update the docs to include this. Have some practical examples such as including the sources jar.

@modmuss50 modmuss50 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im going to make some changes to this PR so it can be merged.

Comment thread src/main/kotlin/me/modmuss50/mpp/ModPublishExtension.kt Outdated
Comment thread src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/Modrinth.kt Outdated
Comment thread src/main/kotlin/me/modmuss50/mpp/ModPublishExtension.kt Outdated
Comment thread src/main/kotlin/me/modmuss50/mpp/platforms/modrinth/ModrinthApi.kt Outdated
@modmuss50
modmuss50 merged commit 7cf0103 into modmuss50:main Jul 29, 2026
2 of 3 checks passed
@srnyx
srnyx deleted the modrinth-file-types branch July 29, 2026 18:21
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.

Add additional files type setting

3 participants