Skip to content

Add optional Version root element to Bjoern spec#99

Merged
Mehtrick merged 6 commits into
masterfrom
copilot/add-version-root-element
Mar 4, 2026
Merged

Add optional Version root element to Bjoern spec#99
Mehtrick merged 6 commits into
masterfrom
copilot/add-version-root-element

Conversation

Copilot AI commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Adds an optional Version field to .zgr spec files for semantic versioning of specifications. When present, it surfaces in the generated Java class as a @version Javadoc tag and in AsciiDoc output immediately after the feature title.

Model & Parsing

  • BjoernZGRModell: new @JsonProperty("Version") field
  • Bjoern: propagates version through constructor and exposes getter/setter
  • BjoernKeywords: added VERSION("Version:") so the validator accepts the keyword

Code Generation

  • BjoernFeatureTestClassBuilder.addJavaDoc(): appends @version <value> only when field is non-blank

Doc Generation

  • asciidoc.ftlh: renders Version: <value> after the feature title, guarded by <#if version??>

Example .zgr usage

Feature: My Feature
Version: "2.1.0"
Scenarios:
  - Scenario: ...

Generated Javadoc:

/**
 * My Feature
 * @version 2.1.0
 */
public abstract class AbstractMyFeature { ... }

Generated AsciiDoc:

= My Feature
:toc:

Version: 2.1.0
Original prompt

This section details on the original issue you should resolve

<issue_title>Neues RootElement "Version"</issue_title>
<issue_description>### Anforderung
Neues Root Element "verion" hinzufügen. Dieses Feld dient zur semantischen nachvollziehbarkeit der aktuellen Version der Spezifikation

Umsetzung

  1. Version in der Bjoern Spec hinzufügen. Dies als Textfeld ergänzen keine weitere semantische Prüfung erforderlich.
  2. Feld ist optional
  3. Im Code die Versionsnummer im Javadoc der Klasse hinterlegen als @Version
  4. In den Docs die Versionsnummer nach dem Featurenamen hinterlegen
  5. Jeweilige Generierung nur vornehmen wenn auch das Feld vorhanden ist</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Mehtrick and others added 3 commits March 4, 2026 21:47
Co-authored-by: Mehtrick <4493019+Mehtrick@users.noreply.github.com>
@Mehtrick Mehtrick marked this pull request as ready for review March 4, 2026 20:50
Copilot AI review requested due to automatic review settings March 4, 2026 20:50
Copilot AI changed the title [WIP] Add new root element 'Version' for specification Add optional Version root element to Bjoern spec Mar 4, 2026
Base automatically changed from copilot/add-reference-field-root to master March 4, 2026 20:55

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

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: Version field added to BjoernZGRModell.java (YAML model) and Bjoern.java (processed model), with BjoernKeywords.java updated so the validator accepts Version: lines in spec files
  • Code generation: BjoernFeatureTestClassBuilder.java conditionally appends @version to the Javadoc block, and asciidoc.ftlh conditionally renders Version: <value> after the feature title
  • Tests: New version.zgr fixture and corresponding unit tests in BjoernFeatureTestClassBuilderTest.java, AsciiDocBuildTest.java, and BjoernValidatorTest.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

@Mehtrick Mehtrick merged commit 44d5f76 into master Mar 4, 2026
4 checks passed
@Mehtrick Mehtrick deleted the copilot/add-version-root-element branch March 4, 2026 20:56
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.

Neues RootElement "Version"

3 participants