Skip to content

Conversation

@egekorkan
Copy link
Member

If a TD has a semantic annotation, it is simply ignored in the conversion. This PR adds a basic support in this direction. I am not exactly satisfied since there can be many corner cases. The worst is if there is an additional context without a prefix. That would mean looking into the context for each possible unknown key. I have added a good amount of comments in the code but also adding now some in the PR review.

Copy link
Member

@danielpeintner danielpeintner left a comment

Choose a reason for hiding this comment

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

Find some comments below.

What I would highly recommend is to add some test-cases by either updating some samples or adding new ones.

EDIT: Some CI tests are failing which proves we should add more tests.

@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2024

Codecov Report

❌ Patch coverage is 44.44444% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.97%. Comparing base (a6943fa) to head (9aabeda).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
node/aas-aid/src/asset-interfaces-description.ts 44.44% 18 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   65.23%   63.97%   -1.26%     
==========================================
  Files           1        1              
  Lines         558      594      +36     
  Branches      224      231       +7     
==========================================
+ Hits          364      380      +16     
- Misses        155      173      +18     
- Partials       39       41       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@egekorkan
Copy link
Member Author

I have fixed the failing test, the assumption based code and adding the new test now

@danielpeintner
Copy link
Member

I think the code looks much better now and I hope we can step-by-step answer some of the TODOs in the source code.
Note: I think you missed to commit the test...

@egekorkan
Copy link
Member Author

egekorkan commented Nov 6, 2024

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

@Kaz040
Copy link

Kaz040 commented Nov 7, 2024

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

I will look at it @egekorkan . Can you please send me the TD you are using for testing and the converted AID?

@Kaz040
Copy link

Kaz040 commented Nov 7, 2024

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

The validation fails because of "myPrefix1_suffix4" term that was converted. The schema does not accept terms that are not defined in AID specification. The terms that are defines are mostly TD terms and protocol binding terms (HTTP,Modbus, and MQTT).

TD:
image

AID:
image

Copy link
Member

@danielpeintner danielpeintner left a comment

Choose a reason for hiding this comment

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

Looks fine. You could also add a test for the outer prefix sample just to be sure

Comment on lines 1370 to 1372
console.log("###\n\n" + JSON.stringify(smObj) + "\n\n###");
// const isValid = this.validateAID(smObj);
// expect(isValid.valid, isValid.errors).to.equal(true);
Copy link
Member

Choose a reason for hiding this comment

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

Remove console log and commented code?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

},
base: "http://example.com:3003",
security: ["nosec_sc"],
"myPrefix2:suffix3": "value1",
Copy link
Member

Choose a reason for hiding this comment

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

This is not part of the test?

myProperty1: {
type: "number",
title: "Property Title",
"myPrefix1:suffix4": "myPrefix2:value4",
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand the idea/system/schema behind the attached numbers but it is fine by me

Copy link
Member Author

Choose a reason for hiding this comment

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

It was just to make sure I create new terms in the AID to make it easier to search where they end up at

@egekorkan
Copy link
Member Author

@Kaz040 @danielpeintner I forgot about this PR but it would be good to get it merged somehow but here are some questions:

  • @danielpeintner your comments are about a section of test I don't have anymore. Did we decide to remove the entire test? You probably don't have an answer neither :(
  • @Kaz040 from your comments I understand that we cannot have this feature at all? The AID schema will not allow unknown words

@Kaz040
Copy link

Kaz040 commented Nov 10, 2025

  • @Kaz040 from your comments I understand that we cannot have this feature at all? The AID schema will not allow unknown words

Yes, we cannot have unknown words for present AID schema.

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.

5 participants