-
Notifications
You must be signed in to change notification settings - Fork 22
added removing 'type' field in dimensions and reportingStandard #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
added removing 'type' field in dimensions and reportingStandard #325
Conversation
Summary of ChangesHello @karinaliauw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with π and π on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request updates the v0.6.0 migration guide to document the removal of the type field from Dimensions and reportingStandard. While reviewing, I found a minor typo and a couple of inconsistencies in the documentation that need to be addressed.
- There's a typo in
emmissionsScorecard. - The
After (0.6.0)example forreportingStandard.issuingPartyincorrectly includes anidScheme, which is inconsistent with the schema and other examples. - The documentation states that the
typefield is removed fromDimensions, but the provided v0.6.0 schema still contains it.
Please see the detailed comments for suggestions.
| - Simplified `issuingParty` in `referenceStandard` schema by removing the nested `idScheme` structure. | ||
| - Simplified `administeredBy` in `Regulation` by removing the nested `idScheme` structure. | ||
| - Simplified `issuingParty` in `emmissionsScorecard`.`reportingStandard` by removing the `type` field. | ||
| - Simplified structure in `Dimensions` by removing the `type` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change states that the type field is removed from the Dimensions structure, and the example at lines 1807-1868 reflects this. However, this contradicts the schema in packages/untp-test-suite/src/schemas/digitalProductPassport/v0.6.0/schema.json, where the Dimension definition (lines 553-597) still includes the type property. Please synchronize the documentation and the schema. If the schema is correct, this documentation change should be reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type property should be removed from the Dimensions object, as I believe itβs an unintended artefact generated by Jargon when producing the DPP Schema. @absoludity, can you shed any light on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't remember any of the context here - can you provide a little more? I don't remember type being an unintended artefact, but I do remember that jsonld interpreters don't require you to set it iff the related context file makes it clear what type a property has. I'm happy to spend some time playing with Jargon to understand, but I also need more context here about what I'm looking for (eg. why is it an issue to specify the type or not - is it causing an error?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jargon is adding types within the schemas where they're not needed, in this case "type": "Dimensions" in the DPP schema.
When developers construct credentials conforming to the respective UNTP schema, they inadvertently add the types, issue credentials and then attempt to validate the credentials with the tooling we provided them.
They are then faced with a relative type reference error. This issue is common throughout the JSON schemas of the UNTP data models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think that maybe the issue is around the other way: The schema should indicate that the "type" for the Dimension entity can be present (it should be a possible to define the "type" on any entity, it's just not always required if the context already tells you what the entity at a given path is).
But yes, the schema has it as required (https://test.uncefact.org/vocabulary/untp/dpp/untp-dpp-schema-0.6.0.json ), so we should include it. The real problem is, IMO, that the context file isn't defining Dimension, but maybe there's a way to stop the type being required in the schema? Best check with Alistair.
Detail
If you look at other entities, such as Claim, you'll see it's defined in the context linked from the dpp example you have, but Dimension isn't. That's the cause of the error: the parser understands that the entity is something called a Dimension, but nothing in the context defines what that is (unlike other entities).
Now the reason Dimension is not defined in the context, is, I think, because it's a "Green" entity in Jargon (that is, an entity which doesn't have a unique identifier). You can read more at https://docs.jargon.sh/#/pages/language?id=identifiers , but basically, if an entity has an identifier, it's then a blue class, and AFAICT, it's the blue classes which have there terms defined in the generated context. You could test this in a copy or working version of the UNTP domain - if you add an id, is Dimension then in the generated context (which would make the error disappear). The problem is, Dimension shouldn't have a unique identifier - it's really a value, not a uniquely identifiable entity. I had a similar (but not the same) issue in the past and raised it as jargon-sh/issues#43 .
I'm not 100%, but I think this might be a mis-match between Jargon and jsonld: for Jargon, having a unique id property means the entity type should be defined in the context. For jsonld, any entity can have a type, regardless of whether it has a unique id. Might be worth asking Alastair (via an issue or similar).
| "issuingParty": { | ||
| "id": "https://www.globalbattery.org/", | ||
| "name": "Global Battery Alliance", | ||
| "registeredId": "123456789", | ||
| "idScheme": { | ||
| "type": [ | ||
| "IdentifierScheme" | ||
| ], | ||
| "id": "https://id.gs1.org/01/", | ||
| "name": "Global Trade Identification Number (GTIN)" | ||
| } | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The After (0.6.0) example for issuingParty within reportingStandard is inconsistent with the schema. According to packages/untp-test-suite/src/schemas/digitalProductPassport/v0.6.0/schema.json, the Standard type (which reportingStandard is) has an issuingParty object that does not include an idScheme. This example should be updated to be consistent with the schema and other examples in this guide (like referenceStandard.issuingParty) by removing the idScheme object.
| "issuingParty": { | |
| "id": "https://www.globalbattery.org/", | |
| "name": "Global Battery Alliance", | |
| "registeredId": "123456789", | |
| "idScheme": { | |
| "type": [ | |
| "IdentifierScheme" | |
| ], | |
| "id": "https://id.gs1.org/01/", | |
| "name": "Global Trade Identification Number (GTIN)" | |
| } | |
| }, | |
| "issuingParty": { | |
| "id": "https://www.globalbattery.org/", | |
| "name": "Global Battery Alliance", | |
| "registeredId": "123456789" | |
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idScheme is a valid property. From memory, I believe this has something to do with the fact that Jargon only includes primitives within the schema when using object references. @absoludity, did Alastair get around to fixing this?
|
@karinaliauw, please see the comments above. |
β¦typo Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@ashleythedeveloper committed minor typo - I will put the remaining Gemini reviews on hold until we heard back from Alastair. |
|
Hi @ashleythedeveloper following up on this PR. Let me know you have any questions. Thank you. |
|
Hi @ashleythedeveloper following up on Karina's updates. Thank you! |
What type of PR is this? (check all applicable)
Description
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings
Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?