Skip to content

Conversation

@WilliamAGH
Copy link
Owner

@WilliamAGH WilliamAGH commented Jan 17, 2026

New Features

  • Origin header support for JWT configurations - Some Apple Maps JWTs require an Origin header matching the token's origin claim. Added optional origin parameter to AppleMaps constructors and APPLE_MAPS_ORIGIN environment variable support in CLI

Refactoring

  • Switch to nmcp + maven-publish - Replace vanniktech plugin with nmcp for Maven Central publishing (aligns with tui4j approach)
  • Manual GPG signing configuration - Use Gradle signing plugin directly with useInMemoryPgpKeys() for more reliable CI signing
  • Update GitHub Actions - Upgrade to actions/checkout@v6, gradle/actions/setup-gradle@v5

Documentation

  • Comprehensive Javadoc - Add documentation to all public classes, constructors, methods, and enum values across the entire API surface
  • Origin header docs - Document APPLE_MAPS_ORIGIN configuration in authorization and CLI docs

Other Changes

  • Bump version to 0.1.4-SNAPSHOT
  • Reorder imports to place java.* before project imports (style consistency)

- Use Gradle signing plugin directly with useInMemoryPgpKeys()
- Read GPG_PRIVATE_KEY and GPG_PASSPHRASE from environment
- Update workflows to pass correct env vars
- Replace vanniktech plugin with nmcp + maven-publish (matches tui4j)
- Use SONATYPE_USERNAME/PASSWORD env vars directly
- Update to actions/checkout@v6, gradle/actions/setup-gradle@v5
- Use publishAllPublicationsToCentralPortal tasks
Increment version from 0.1.2 to 0.1.3 across all project configuration
files and documentation in preparation for the next release.

- Update VERSION_NAME to 0.1.3-SNAPSHOT in gradle.properties
- Update fallback version to 0.1.3 in build.gradle.kts
- Update installation examples in README.md to reference 0.1.3
Add Javadoc documentation to all public classes, constructors, methods,
and enum values to improve developer experience and enable proper API
documentation generation. This includes the main client, gateway
interface, domain models, request builders, and adapter layer.

- Document AppleMaps client constructors and all public methods
- Document AppleMapsGateway port interface methods
- Add constructor Javadoc to domain records explaining parameter normalization
- Document all PoiCategory, AddressCategory, and other enum values
- Document request input builders and their fluent methods
- Document adapter exceptions and their accessors
- Document CLI entry point
Some Apple Maps JWT configurations require an Origin header that matches
the origin claim in the token. This adds optional origin support throughout
the SDK, allowing users to specify the origin via constructor parameter or
environment variable.

- Add origin parameter to AppleMaps constructors with overloads
- Thread origin through HttpAppleMapsGateway to AppleMapsAuthorizationService
- Set Origin header on token refresh and API requests when provided
- Add getOrigin() accessor to AppleMapsAuthorizationService
- Update CLI to read APPLE_MAPS_ORIGIN from env/system properties
- Reorder imports to place java.* before project imports (style consistency)
Update documentation to explain how to configure the optional Origin header
for JWT configurations that require it.

- Add APPLE_MAPS_ORIGIN to environment variable examples
- Update code example showing origin parameter usage
- Document origin option in CLI prerequisites
@WilliamAGH WilliamAGH self-assigned this Jan 17, 2026
Copilot AI review requested due to automatic review settings January 17, 2026 05:43
@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for optional origin header in JWT token authentication.
    • Expanded place category options with 50+ new POI types.
    • Added transportation modes: transit, walking, and cycling.
    • Enhanced search with new result types and address categories.
  • Documentation

    • Updated configuration guidance for optional origin-based JWT tokens.
  • Chores

    • Updated publishing configuration and bumped version to 0.1.4.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This release adds comprehensive origin header support for JWT authentication, refactors the publishing pipeline from Maven Central to Sonatype Central Portal, introduces builder patterns and query string serialization for request objects, and applies systematic normalization/validation to domain models throughout the codebase.

Changes

Cohort / File(s) Summary
Build & Publishing Infrastructure
build.gradle.kts, .github/workflows/CI.yaml, .github/workflows/Release.yaml, gradle.properties
Migrated from com.vanniktech.maven.publish plugin to native Gradle publishing with NMCP (Central Portal). Updated Gradle credentials to use standard secret-suffixed environment variables. Changed publish targets from MavenCentralRepository to CentralPortal. Version bump from 0.1.2 to 0.1.4-SNAPSHOT.
Documentation Updates
README.md, docs/authorization.md, docs/cli.md
Updated version references (0.1.2 → 0.1.3). Added APPLE_MAPS_ORIGIN environment variable documentation for JWT origin requirements. Updated constructor examples to include origin parameter.
Core API Expansion
src/main/java/com/williamcallahan/applemaps/AppleMaps.java, src/main/java/com/williamcallahan/applemaps/domain/port/AppleMapsGateway.java
Added multiple overloaded constructors supporting origin and custom timeout. Introduced gateway-backed API methods (geocode, search, autocomplete, reverseGeocode, directions, etas, lookupPlace, lookupPlaces, lookupAlternateIds). Added asynchronous completion URL resolution. Expanded AppleMapsGateway interface with 11 new public methods.
Authorization & Origin Header Flow
src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsAuthorizationService.java, src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/HttpAppleMapsGateway.java, src/main/java/com/williamcallahan/applemaps/cli/AppleMapsCli.java
Extended authentication service and HTTP gateway to accept and propagate origin parameter. Updated HTTP request building to conditionally include Origin header when present. Added CLI support for APPLE_MAPS_ORIGIN environment variable resolution.
Exception & Utility Classes
src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsApiException.java, src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsClientException.java, src/main/java/com/williamcallahan/applemaps/adapters/jackson/AppleMapsObjectMapperFactory.java
Added public accessor methods statusCode() and responseBody() to AppleMapsApiException. Added Javadoc documentation for exception classes and ObjectMapper factory.
Domain Models - Enum Expansions
src/main/java/com/williamcallahan/applemaps/domain/model/AddressCategory.java, src/main/java/com/williamcallahan/applemaps/domain/model/PoiCategory.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchACResultType.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchResultType.java, src/main/java/com/williamcallahan/applemaps/domain/model/TransportType.java
Added multiple new enum constants (AddressCategory: COUNTRY, ADMINISTRATIVE_AREA, etc.; PoiCategory: 45 new constants including AIRPORT, RESTAURANT, HOTEL; SearchACResultType: ADDRESS, PHYSICAL_FEATURE, POINT_OF_INTEREST, QUERY; SearchResultType: ADDRESS, PHYSICAL_FEATURE, POINT_OF_INTEREST; TransportType: TRANSIT, WALKING, CYCLING). Added apiValue() accessor methods and Javadoc.
Domain Models - Normalization & Validation
src/main/java/com/williamcallahan/applemaps/domain/model/AlternateIdsEntry.java, src/main/java/com/williamcallahan/applemaps/domain/model/AlternateIdsResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/AutocompleteResult.java, src/main/java/com/williamcallahan/applemaps/domain/model/DirectionsResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/DirectionsRoute.java, src/main/java/com/williamcallahan/applemaps/domain/model/DirectionsStep.java, src/main/java/com/williamcallahan/applemaps/domain/model/ErrorResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/EtaEstimate.java, src/main/java/com/williamcallahan/applemaps/domain/model/EtaResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/PaginationInfo.java, src/main/java/com/williamcallahan/applemaps/domain/model/Place.java, src/main/java/com/williamcallahan/applemaps/domain/model/PlaceLookupError.java, src/main/java/com/williamcallahan/applemaps/domain/model/PlaceResults.java, src/main/java/com/williamcallahan/applemaps/domain/model/PlacesResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchAutocompleteResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchResponse.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchResponsePlace.java, src/main/java/com/williamcallahan/applemaps/domain/model/StructuredAddress.java, src/main/java/com/williamcallahan/applemaps/domain/model/TokenResponse.java
Added canonical constructors with systematic normalization of null inputs (Optional fields → Optional.empty(), List fields → immutable empty lists). Introduced private helper methods (normalizeOptional, normalizeList) across models. Added null-safety validation via Objects.requireNonNull for required fields.
Domain Models - Coordinate & Region Utilities
src/main/java/com/williamcallahan/applemaps/domain/model/DirectionsEndpoint.java, src/main/java/com/williamcallahan/applemaps/domain/model/RouteLocation.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchLocation.java, src/main/java/com/williamcallahan/applemaps/domain/model/SearchRegion.java, src/main/java/com/williamcallahan/applemaps/domain/model/UserLocation.java
Added factory methods (fromLatitudeLongitude, fromBounds, fromSearchMapRegion) and query string serialization methods (toQueryString) for coordinate and region representations. Added constructor validation for coordinate bounds.
Request Objects - Builders & Query Serialization
src/main/java/com/williamcallahan/applemaps/domain/request/AlternateIdsInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/DirectionsInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/EtaInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/GeocodeInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/PlaceLookupInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/SearchAutocompleteInput.java, src/main/java/com/williamcallahan/applemaps/domain/request/SearchInput.java
Introduced builder patterns with fluent APIs for all input classes. Added toQueryString() serialization methods for API communication. Implemented canonical constructors with field normalization and validation. Added private helper utilities (normalizeList, normalizeOptional, joinEncoded, joinApiValues, formatParameter, encode).
Tests
src/test/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsAuthorizationServiceTest.java
Updated test constructor calls to include new origin parameter for DependenciesConfig.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AppleMaps
    participant HttpAppleMapsGateway
    participant AuthService as AppleMapsAuthorizationService
    participant HttpClient as HTTP Client
    participant API as Apple Maps API

    Client->>AppleMaps: AppleMaps(token, origin)
    AppleMaps->>HttpAppleMapsGateway: HttpAppleMapsGateway(token, origin)
    HttpAppleMapsGateway->>AuthService: AppleMapsAuthorizationService(token, timeout, origin)
    AuthService->>AuthService: Store origin internally

    Client->>AppleMaps: geocode(input)
    AppleMaps->>HttpAppleMapsGateway: geocode(input)
    HttpAppleMapsGateway->>AuthService: getOrigin()
    AuthService-->>HttpAppleMapsGateway: Return origin value

    HttpAppleMapsGateway->>HttpAppleMapsGateway: Build HTTP request<br/>conditionally add Origin header
    HttpAppleMapsGateway->>HttpClient: POST with headers<br/>(Authorization, Origin)
    HttpClient->>API: Request with Origin header
    API-->>HttpClient: Response
    HttpClient-->>HttpAppleMapsGateway: PlaceResults
    HttpAppleMapsGateway-->>AppleMaps: PlaceResults
    AppleMaps-->>Client: PlaceResults
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Poem

🔐 Origin headers now flow with grace,
Through gateways where builders find their place.
Null-safety blooms in every field,
Immutable lists and enums revealed.
From Maven halls to Central Portal we fly,
With normalization reaching the sky! 🚀

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands and usage tips.

@WilliamAGH WilliamAGH changed the title merge Add Origin header support, switch to nmcp publishing, comprehensive Javadoc Jan 17, 2026
@WilliamAGH WilliamAGH merged commit 329b37d into main Jan 17, 2026
5 of 6 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the Origin HTTP header in Apple Maps Server API requests and includes extensive Javadoc documentation across the codebase. The Origin header is required for some JWT token configurations, making this an important enhancement for certain API usage scenarios.

Changes:

  • Added optional origin parameter throughout the authorization and gateway layers to support Origin header in API requests
  • Added comprehensive Javadoc documentation to all public APIs, domain models, and builder classes
  • Migrated from vanniktech maven-publish plugin to standard Gradle publishing with nmcp plugin for Maven Central deployment
  • Updated version to 0.1.4-SNAPSHOT and adjusted documentation to reference 0.1.3

Reviewed changes

Copilot reviewed 54 out of 55 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/com/williamcallahan/applemaps/AppleMaps.java Added constructors accepting optional origin parameter and comprehensive Javadoc
src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsAuthorizationService.java Added origin field and logic to include Origin header in token exchange requests
src/main/java/com/williamcallahan/applemaps/adapters/mapsserver/HttpAppleMapsGateway.java Added origin parameter and logic to conditionally set Origin header on API requests
src/main/java/com/williamcallahan/applemaps/cli/AppleMapsCli.java Added resolveOrigin() method to read APPLE_MAPS_ORIGIN environment variable
src/test/java/com/williamcallahan/applemaps/adapters/mapsserver/AppleMapsAuthorizationServiceTest.java Updated tests to pass "origin" parameter in test dependencies
src/main/java/com/williamcallahan/applemaps/domain/request/*.java Added Javadoc to constructors, builders, and public methods
src/main/java/com/williamcallahan/applemaps/domain/model/*.java Added Javadoc to canonical constructors and enum values
src/main/java/com/williamcallahan/applemaps/domain/port/AppleMapsGateway.java Added Javadoc to all interface methods
build.gradle.kts Migrated from vanniktech plugin to standard Gradle publishing with nmcp plugin
gradle.properties Updated version from 0.1.2-SNAPSHOT to 0.1.4-SNAPSHOT
docs/*.md Updated documentation to reference Origin header configuration
.github/workflows/*.yaml Updated environment variables for new signing approach
README.md Updated version references from 0.1.2 to 0.1.3

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

SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./gradlew publishAllPublicationsToCentralPortalSnapshots -x test
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

The task name publishAllPublicationsToCentralPortalSnapshots used in the CI workflow does not exist. The nmcp plugin configuration only defines publishAllPublicationsToCentralPortal, which is meant for releases. For SNAPSHOT publishing, you should either use the standard Maven publishing task publishAllPublicationsToMavenRepository or configure a separate nmcp task for snapshots. The nmcp plugin's publishAllPublicationsToCentralPortal task is typically used for releases, not snapshots.

Suggested change
run: ./gradlew publishAllPublicationsToCentralPortalSnapshots -x test
run: ./gradlew publishAllPublicationsToMavenRepository -x test

Copilot uses AI. Check for mistakes.
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