Skip to content

Fix CODESYS XML export namespace for variable documentation#722

Open
manux81 wants to merge 6 commits into
Autonomy-Logic:developmentfrom
manux81:fix/codesys-variable-doc-namespace
Open

Fix CODESYS XML export namespace for variable documentation#722
manux81 wants to merge 6 commits into
Autonomy-Logic:developmentfrom
manux81:fix/codesys-variable-doc-namespace

Conversation

@manux81
Copy link
Copy Markdown

@manux81 manux81 commented Apr 9, 2026

Pull request info

References

If applicable substitute the issue reference to the one that this PR refers

This PR resolve the N/A.

Link to Jira task

N/A

Description of the changes proposed

  • declare the xhtml namespace in generated CODESYS PLCopen XML documents
  • keep the shared CODESYS XML schema aligned with the new namespace attribute
  • preserve the namespace update after the frontend/shared path reorganization in development
  • add coverage for variable documentation exports and initial value serialization so the namespace stays present

DOD checklist

  • The code is complete and according to developers’ standards.
  • I have performed a self-review of my code.
  • Meet the acceptance criteria.
  • Unit tests are written and green.
  • Test coverage: N/A %.
  • Integration tests are written and green.
  • Changes were communicated and updated in the ticket description.
  • Reviewed and accepted by the Product Owner.
  • End-to-end test are successful.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

Walkthrough

Added the @xmlns:xhtml attribute to CodeSys project schema and XML generator; added tests verifying BOOL and numeric initial value serialization and presence of the xmlns:xhtml namespace and xhtml:p documentation elements.

Changes

Cohort / File(s) Summary
XML Schema & Generator Updates
src/types/PLC/xml-data/codesys/base-diagram.ts, src/utils/PLC/xml-generator/codesys/base-xml.ts
Added project['@xmlns:xhtml'] / @xmlns:xhtml with default http://www.w3.org/1999/xhtml to schema and to the root project element produced by the generator.
Test Suite
src/utils/PLC/xml-generator/xml-generator-initial-values.spec.ts
New tests covering initial value serialization/parsing for CodeSys and legacy editor variants; asserts BOOL false and numeric 0 values serialize as "false" / "0", verifies xmlns:xhtml is emitted when documentation exists, and that documentation appears as xhtml:p with the original text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nibble namespaces with a cheerful twitch,
xhtml tucked in XML, neat as a stitch.
False and zero now show their face,
Docs wrapped in xhtml:p — tidy place.
Hop, hop—tests pass in a dainty little pitch.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding the CODESYS XML namespace for variable documentation, which is the core fix across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description adequately covers the proposed changes, references, and objectives. It includes clear bullet points describing the modifications and provides context about the namespace issue.

✏️ 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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/utils/PLC/xml-generator/xml-generator-initial-values.spec.ts`:
- Line 24: The test fixtures use four `as any` casts which suppress TypeScript
checks; replace each `as any` with a proper `satisfies` assertion against the
corresponding Zod-backed types (e.g. use `... satisfies PLCPou`, `... satisfies
PLCConfiguration`, or `... satisfies BaseXml` as appropriate for each fixture)
so the static shape is validated without widening to `any`; update the four
occurrences currently cast to `as any` to use `satisfies <Type>` matching the
fixture intent and ensure imports/references to `PLCPou`, `PLCConfiguration`,
and `BaseXml` are present for the assertions.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 07fd32b1-848b-40d1-b416-70a4eaf9b639

📥 Commits

Reviewing files that changed from the base of the PR and between 195eacc and 4e2c4c0.

📒 Files selected for processing (3)
  • src/types/PLC/xml-data/codesys/base-diagram.ts
  • src/utils/PLC/xml-generator/codesys/base-xml.ts
  • src/utils/PLC/xml-generator/xml-generator-initial-values.spec.ts

Comment thread src/utils/PLC/xml-generator/xml-generator-initial-values.spec.ts Outdated
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