Skip to content

Conversation

@yyin-talend
Copy link
Collaborator

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

What does this PR adds (design/code thoughts)?

@sonar-eks
Copy link

sonar-eks bot commented Jan 16, 2026

Failed Quality Gate failed

  • 0.00% Coverage on New Code (is less than 80.00%)
  • 2 New Issues (is greater than 0)

Project ID: org.talend.sdk.component:component-runtime

View in SonarQube

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 PR adds JSON deserialization capability for Schema and Entry models, enabling the component server to parse JSON representations into Schema instances. The changes support comprehensive schema definition including all data types, nested structures, metadata entries, and logical types.

Changes:

  • Added Schema and Entry model classes with Jackson deserialization support
  • Implemented comprehensive test coverage for all schema types and field parameters
  • Moved component-server-api dependency to test scope and added jackson-databind for testing

Reviewed changes

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

Show a summary per file
File Description
Schema.java New model class representing schema structure with type, entries, metadata, and properties
Entry.java New model class representing schema entry with support for nested schemas and typed default values
SchemaTest.java Comprehensive test suite covering serialization/deserialization of all schema types and configurations
EntryTest.java Unit tests for Entry class including JSON deserialization and accessor methods
pom.xml Dependency reorganization moving component-server-api to test scope and adding jackson-databind

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

Comment on lines +55 to +56
public String getProp(final String key) {
return this.props.get(key);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The getProp method will throw NullPointerException if props is null. Add a null check before accessing props, or ensure props is never null in the constructor.

Copilot uses AI. Check for mistakes.
this.valid = valid;
this.elementSchema = elementSchema;
this.comment = comment;
this.props.putAll(props);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The constructor will throw NullPointerException if the props parameter is null. Add a null check before calling putAll, e.g., if (props != null) { this.props.putAll(props); }

Suggested change
this.props.putAll(props);
if (props != null) {
this.props.putAll(props);
}

Copilot uses AI. Check for mistakes.
public String getOriginalFieldName() {
return rawName != null ? rawName : name;
}

Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Consider documenting that getProp returns null when the key doesn't exist. This is standard Map behavior but worth clarifying for API consumers.

Suggested change
/**
* Returns the property value associated with the given key.
*
* @param key the property key
* @return the property value, or {@code null} if there is no mapping for the given key
*/

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +81
private Object getInternalDefaultValue() {
return defaultValue;
}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The getInternalDefaultValue method appears to be a simple getter for the defaultValue field. Consider removing this method and accessing the field directly in getDefaultValue() to reduce unnecessary indirection.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ypiel-talend ypiel-talend left a comment

Choose a reason for hiding this comment

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

Some minor changes requested

</dependency>
<dependency>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-api</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why it has been moved ?

</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this dependency

*
* @return true if input is null or ok.
*/
public boolean isCompatible(final Object input) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this method, it is not used.

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