Skip to content

Use Maven's standard coordinate order and document compact string syntax#54

Open
gnodet wants to merge 2 commits into
maveniverse:mainfrom
gnodet:docs/compact-string-syntax
Open

Use Maven's standard coordinate order and document compact string syntax#54
gnodet wants to merge 2 commits into
maveniverse:mainfrom
gnodet:docs/compact-string-syntax

Conversation

@gnodet

@gnodet gnodet commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Breaking change: Fix dependency coordinate parsing to use Maven's standard format where version comes last: g:a[:type[:classifier]]:version instead of the previous g:a:version:type:classifier. This only affects dependencies that specify type or classifier — the common g:a:v and g:a:v@scope forms are unchanged.
  • Add a "Compact String Syntax" section to the README documenting all shorthand formats: GAV strings, dependency strings, the id field, and direct string values

Test plan

  • All 77 existing tests pass
  • Updated dependency-gav.yaml test fixtures to use the corrected coordinate order
  • Cross-checked parsing logic against Maven's standard format

Claude Code on behalf of Guillaume Nodet

🤖 Generated with Claude Code

The README showed the shorthand syntax in examples but never explained
the format. Add a dedicated reference section covering GAV strings,
dependency strings (GASVTCO), the id field, and direct string values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 4- and 5-part dependency coordinate parsing in parseGasvtcoString is reordered so that version is always taken from the last segment and type/classifier from preceding segments (previously version and type positions were swapped). Test fixtures and expected values are updated to match. A new README section documents the full compact string syntax.

Changes

Coordinate Parsing Fix and Compact Syntax Documentation

Layer / File(s) Summary
Coordinate parsing logic
extension/src/main/java/eu/maveniverse/maven/mason/JsonReaderHelper.java
Javadoc and null-check message updated to describe Maven-standard dependency coordinate format; 4-part parsing now assigns [g, a, type, version] and 5-part assigns [g, a, type, classifier, version]; "too many parts" error updated.
Test fixtures and expectations
extension/src/test/resources/yaml/dependency-gav.yaml, extension/src/test/java/eu/maveniverse/maven/mason/YamlParserTest.java
YAML fixture entries rewritten from g:a:v:type / g:a:v:type:classifier@scope to g:a:type:v / g:a:type:classifier:v@scope; corresponding Dependency builder expectations updated in testDependencyGavParsing.
README compact string syntax docs
README.md
New "Compact String Syntax" section added documenting GAV strings, dependency string delimiter mapping, scope and optional-dependency suffixes, the id field, and direct string value equivalence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the segments now align,
Version last, in Maven's grand design.
g:a:type:v — so clear, so neat,
The docs bloom bright, the tests complete.
A rabbit's fix, both sharp and fine! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: standard Maven coordinate ordering and new compact string syntax documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

The dependency coordinate parser was using g:a:v:type:classifier but
Maven's standard format puts version last: g:a[:type[:classifier]]:version.
Align the parsing order to match Maven conventions and document the
compact string syntax in the README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet changed the title Document compact string syntax in README Use Maven's standard coordinate order and document compact string syntax Jun 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@extension/src/main/java/eu/maveniverse/maven/mason/JsonReaderHelper.java`:
- Around line 132-140: The legacy dependency parsing in JsonReaderHelper is
silently remapping 4/5-part strings into different Dependency fields, which can
corrupt existing YAML after upgrades. Update the parsing logic in
JsonReaderHelper so legacy formats like g:a:v:type and g:a:v:type:classifier are
either interpreted in the same field order as before or explicitly rejected with
a clear exception instead of being reassigned to version/type/classifier. Make
sure the behavior matches the expectations of the Jackson reader mapping in the
generated reader path so existing coordinates do not deserialize with swapped
metadata.

In `@README.md`:
- Around line 208-210: Add explicit language tags to the unlabeled fenced code
blocks in the README so markdownlint MD040 is satisfied. Update the fenced
blocks around the groupId:artifactId examples to use a consistent label such as
text or ebnf, and make the same change for the matching block later in the
document; use the README fenced code examples near the groupId:artifactId
patterns to locate them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9d6b971-b852-4516-a2d0-ac08db4fd741

📥 Commits

Reviewing files that changed from the base of the PR and between 27c498e and d700eb4.

📒 Files selected for processing (4)
  • README.md
  • extension/src/main/java/eu/maveniverse/maven/mason/JsonReaderHelper.java
  • extension/src/test/java/eu/maveniverse/maven/mason/YamlParserTest.java
  • extension/src/test/resources/yaml/dependency-gav.yaml

Comment on lines +132 to +140
if (parts.length == 3) {
result[3] = parts[2].isEmpty() ? null : parts[2]; // version
} else if (parts.length == 4) {
result[4] = parts[2].isEmpty() ? null : parts[2]; // type
result[3] = parts[3].isEmpty() ? null : parts[3]; // version
} else if (parts.length == 5) {
result[4] = parts[2].isEmpty() ? null : parts[2]; // type
result[5] = parts[3].isEmpty() ? null : parts[3]; // classifier
result[3] = parts[4].isEmpty() ? null : parts[4]; // version

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Avoid silently reinterpreting legacy 4/5-part dependency strings.

Lines 134-140 turn previously accepted g:a:v:type / g:a:v:type:classifier inputs into different Dependency objects instead of an upgrade-time error. With the caller in extension/src/main/mdo/jackson-reader.vm:262-306 mapping index 3 to version and 4/5 to type/classifier, existing YAML will now deserialize with swapped metadata and no exception. Please either preserve the legacy order for compatibility or reject it explicitly so upgrades fail fast rather than corrupting dependency coordinates.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@extension/src/main/java/eu/maveniverse/maven/mason/JsonReaderHelper.java`
around lines 132 - 140, The legacy dependency parsing in JsonReaderHelper is
silently remapping 4/5-part strings into different Dependency fields, which can
corrupt existing YAML after upgrades. Update the parsing logic in
JsonReaderHelper so legacy formats like g:a:v:type and g:a:v:type:classifier are
either interpreted in the same field order as before or explicitly rejected with
a clear exception instead of being reassigned to version/type/classifier. Make
sure the behavior matches the expectations of the Jackson reader mapping in the
generated reader path so existing coordinates do not deserialize with swapped
metadata.

Comment thread README.md
Comment on lines +208 to +210
```
groupId:artifactId[:version]
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add language tags to fenced code blocks to satisfy markdownlint (MD040).

Line 208 and Line 223 use unlabeled fenced blocks, which triggers lint warnings. Add an explicit language (for example text or ebnf).

Suggested patch
-```
+```text
 groupId:artifactId[:version]

- +text
groupId:artifactId[[:type[:classifier]]:version][@scope][?]

Also applies to: 223-225

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 208-208: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 208 - 210, Add explicit language tags to the
unlabeled fenced code blocks in the README so markdownlint MD040 is satisfied.
Update the fenced blocks around the groupId:artifactId examples to use a
consistent label such as text or ebnf, and make the same change for the matching
block later in the document; use the README fenced code examples near the
groupId:artifactId patterns to locate them.

Source: Linters/SAST tools

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