Skip to content

Conversation

@pditommaso
Copy link
Member

@pditommaso pditommaso commented Oct 9, 2025

Summary

This PR refactors the RegistryClient to leverage typed model classes from the io.seqera:npr-api library instead of using raw maps and manual JSON construction. This improves type safety, maintainability, and ensures compatibility with the Nextflow Plugin Registry API specification.

Key Changes

  • Added npr-api dependency: Integrated io.seqera:npr-api:0.15.0 for typed API models
  • Added Jackson dependencies: Added jackson-databind and jackson-datatype-jsr310 for JSON serialization
  • Refactored request/response handling:
    • createDraftRelease() now uses CreatePluginReleaseRequest and CreatePluginReleaseResponse models
    • Removed manual JSON map construction in favor of model classes with fluent API
  • Shadow JAR implementation: Configured Shadow plugin to bundle all dependencies into a self-contained artifact

Shadow JAR for Dependency Bundling

The plugin now uses the Gradle Shadow plugin to create a self-contained JAR that bundles all dependencies, including npr-api from Seqera's private Maven repository. This eliminates the need for plugin consumers to manually configure additional Maven repositories.

Key implementation details:

  • Zero consumer configuration: Plugin users no longer need to add Seqera's Maven repository to their pluginManagement block
  • Package relocation: Common libraries (Gson, Jackson, Commons IO) are relocated to io.nextflow.shadow.* to prevent classpath conflicts
  • Self-contained artifact: Single 8.4 MB JAR includes all dependencies needed at runtime
  • includeBuild compatibility: Works seamlessly with composite builds without publishToMavenLocal

Trade-offs:

  • Larger artifact size (8.4 MB vs ~80 KB) - acceptable one-time download cost for Gradle plugin distribution
  • Increased build complexity with Shadow plugin configuration
  • Improved user experience by eliminating manual repository configuration

See adr/20251024-shadow-jar-dependency-bundling.md for full technical details.

Benefits

  • Type Safety: Compile-time checking for API request/response structure
  • Maintainability: Single source of truth for API models (npr-api library)
  • API Compatibility: Ensures alignment with the official registry API specification
  • Better IDE Support: Autocomplete and type hints for API model fields
  • Simplified Distribution: No additional repository configuration required by consumers

Testing

  • All existing tests pass with the new implementation
  • WireMock-based tests verify correct JSON serialization format

🤖 Generated with Claude Code

- Replace manual JSON handling with npr-api models and Jackson ObjectMapper
- Use CreatePluginReleaseRequest with fluent API for building requests
- Use CreatePluginReleaseResponse for parsing responses
- Add Jackson dependencies (jackson-databind and jackson-datatype-jsr310)
- Register JavaTimeModule to handle OffsetDateTime fields
- Fix test mocks to use proper PluginRelease fields instead of non-existent status field

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso
Copy link
Member Author

@claude review

@claude
Copy link

claude bot commented Oct 9, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

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.

1 participant