Skip to content

Conversation

@rousso
Copy link
Contributor

@rousso rousso commented Dec 26, 2025

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for notice type/subtype handling and introduces new component types (EFX_RULES_TRANSLATOR and VALIDATOR_GENERATOR) to the SDK component factory. The primary additions include a new entity class for notice subtypes and a repository to manage them.

Key changes:

  • Introduces SdkNoticeSubtype entity class to represent notice subtypes from the SDK's notice-types.json file
  • Adds SdkNoticeTypeRepository to load and manage notice subtype data
  • Extends component type enumeration to support EFX rules translator and validator generator functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SdkNoticeSubtype.java New abstract entity class representing notice subtypes with fields for subTypeId, documentType, and type
SdkNoticeTypeRepository.java New repository class extending MapFromJson to load notice subtypes from JSON
SdkEntityFactory.java Adds factory method getSdkNoticeType to instantiate SdkNoticeSubtype implementations
SdkComponentType.java Extends enum with NOTICE_TYPE, EFX_RULES_TRANSLATOR, and VALIDATOR_GENERATOR component types
SdkConstants.java Adds NOTICE_TYPES_JSON_SUBTYPES_KEY constant for JSON parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rousso rousso self-assigned this Dec 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +64
public int compareTo(SdkNoticeSubtype o) {
return this.subTypeId.compareTo(o.subTypeId);
}
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The compareTo method can throw a NullPointerException if subTypeId is null. The JsonNode constructor (line 21) uses asText(null) which can return null. Consider adding null safety checks or using Objects.compare with a null-safe comparator, similar to how SdkCodelist handles this (see SdkCodelist.java:67-69).

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +32
public String getId() {
return subTypeId;
}
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The getId() method returns subTypeId which can be null (set via asText(null) in the JsonNode constructor at line 21). This could cause NullPointerException in callers who expect a non-null value, such as in SdkNoticeTypeRepository.java:26 where it's used as a map key, and in the compareTo method. Consider validating that critical fields like subTypeId are non-null after construction, or document that null is a valid return value.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +23
this.subTypeId = json.get("subTypeId").asText(null);
this.documentType = json.get("documentType").asText(null);
this.type = json.get("type").asText(null);
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The JsonNode constructor does not validate that required JSON fields (subTypeId, documentType, type) exist before accessing them. If json.get("subTypeId") returns null, calling asText(null) on it will throw a NullPointerException. Consider adding null checks or using safer accessor methods like json.has("subTypeId") before accessing, consistent with how SdkNode handles optional fields (see SdkNode.java:27).

Suggested change
this.subTypeId = json.get("subTypeId").asText(null);
this.documentType = json.get("documentType").asText(null);
this.type = json.get("type").asText(null);
if (json == null) {
throw new IllegalArgumentException("json must not be null when creating SdkNoticeSubtype");
}
JsonNode subTypeIdNode = json.get("subTypeId");
JsonNode documentTypeNode = json.get("documentType");
JsonNode typeNode = json.get("type");
if (subTypeIdNode == null || documentTypeNode == null || typeNode == null) {
throw new IllegalArgumentException("Missing required fields (subTypeId, documentType, type) in notice subtype JSON: " + json);
}
this.subTypeId = subTypeIdNode.asText(null);
this.documentType = documentTypeNode.asText(null);
this.type = typeNode.asText(null);

Copilot uses AI. Check for mistakes.
@bertrand-lorentz
Copy link
Contributor

Is this ready for review ? I'm not indicated as a reviewer.

Copy link
Contributor

@bertrand-lorentz bertrand-lorentz left a comment

Choose a reason for hiding this comment

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

Can go as-is, but please have a look at my comments on the enum value, and the missing update of README files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar classes in this folder are described in the README file in the folder. So this new class should also be described in this README, for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot please address this remark by adding an adequate reference to this class in the respected README file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar classes in this folder are described in the README file in the folder. So this new class should also be described in this README, for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot please address this remark by adding an adequate reference to this class in the respected README file.

*/
public enum SdkComponentType {
FIELD, NODE, CODELIST, EFX_EXPRESSION_TRANSLATOR, EFX_TEMPLATE_TRANSLATOR, SYMBOL_RESOLVER, SCRIPT_GENERATOR, MARKUP_GENERATOR;
FIELD, NODE, CODELIST, NOTICE_TYPE, EFX_EXPRESSION_TRANSLATOR, EFX_TEMPLATE_TRANSLATOR, EFX_RULES_TRANSLATOR,
Copy link
Contributor

Choose a reason for hiding this comment

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

The value name "NOTICE_TYPE" is inconsistent with the corresponding class SdkNoticeSubtype, but it corresponds to the folder named "notice-types" in the SDK.
So I'm not sure which is the best name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure either... We will have a name finalisation debate before we release the SDK. The subtypes are a common naming problem but there are others like for example the fact that we interchangeably use the terms "string" and "text" in the grammar. We will deal with any such remaining naming issues when all else i ready.

Copy link

Copilot AI commented Jan 6, 2026

@rousso I've opened a new pull request, #41, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Jan 6, 2026

@rousso I've opened a new pull request, #42, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 6, 2026 19:33
* Initial plan

* Add SdkNoticeTypeRepository reference to README

Co-authored-by: rousso <91379+rousso@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
* Initial plan

* Add SdkNoticeSubtype reference to entity README

Co-authored-by: rousso <91379+rousso@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
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.

3 participants