Add optional Version root element to Bjoern spec#99
Merged
Conversation
Co-authored-by: Mehtrick <4493019+Mehtrick@users.noreply.github.com>
…' into copilot/add-version-root-element
Copilot
AI
changed the title
[WIP] Add new root element 'Version' for specification
Add optional Mar 4, 2026
Version root element to Bjoern spec
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements issue #89 by adding an optional Version root element to Bjoern specification files (.zgr). When present, the version is included as a @version Javadoc tag in generated Java test classes and rendered after the feature title in AsciiDoc documentation output.
Changes:
- Model and parsing:
Versionfield added toBjoernZGRModell.java(YAML model) andBjoern.java(processed model), withBjoernKeywords.javaupdated so the validator acceptsVersion:lines in spec files - Code generation:
BjoernFeatureTestClassBuilder.javaconditionally appends@versionto the Javadoc block, andasciidoc.ftlhconditionally rendersVersion: <value>after the feature title - Tests: New
version.zgrfixture and corresponding unit tests inBjoernFeatureTestClassBuilderTest.java,AsciiDocBuildTest.java, andBjoernValidatorTest.java
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/test/resources/version.zgr |
New test fixture spec with a Version field |
src/main/java/de/mehtrick/bjoern/parser/validator/validations/BjoernKeywords.java |
Adds VERSION("Version:") enum constant for keyword validation |
src/main/java/de/mehtrick/bjoern/parser/modell/BjoernZGRModell.java |
Adds Version YAML property to the raw spec model |
src/main/java/de/mehtrick/bjoern/parser/modell/Bjoern.java |
Adds version field to the processed model with getter/setter |
src/main/java/de/mehtrick/bjoern/generator/builder/BjoernFeatureTestClassBuilder.java |
Conditionally appends @version Javadoc tag when version is present |
src/main/resources/asciidoc.ftlh |
Conditionally renders version line in AsciiDoc output |
src/test/java/de/mehtrick/bjoern/parser/BjoernValidatorTest.java |
Updates expected keyword list to include Version: |
src/test/java/de/mehtrick/bjoern/generator/builder/BjoernFeatureTestClassBuilderTest.java |
Adds test for @version Javadoc generation |
src/test/java/de/mehtrick/bjoern/asciidoc/AsciiDocBuildTest.java |
Adds test for version rendering in AsciiDoc output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional
Versionfield to.zgrspec files for semantic versioning of specifications. When present, it surfaces in the generated Java class as a@versionJavadoc tag and in AsciiDoc output immediately after the feature title.Model & Parsing
BjoernZGRModell: new@JsonProperty("Version")fieldBjoern: propagatesversionthrough constructor and exposes getter/setterBjoernKeywords: addedVERSION("Version:")so the validator accepts the keywordCode Generation
BjoernFeatureTestClassBuilder.addJavaDoc(): appends@version <value>only when field is non-blankDoc Generation
asciidoc.ftlh: rendersVersion: <value>after the feature title, guarded by<#if version??>Example
.zgrusageGenerated Javadoc:
Generated AsciiDoc:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.