Skip to content
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

Change getAdditionalProperties by getName and getValue. #380

Closed
Tracked by #1247
fjtirado opened this issue Jun 26, 2024 · 0 comments · Fixed by #383
Closed
Tracked by #1247

Change getAdditionalProperties by getName and getValue. #380

fjtirado opened this issue Jun 26, 2024 · 0 comments · Fixed by #383
Assignees
Labels
enhancement New feature or request spec:1.0.0

Comments

@fjtirado
Copy link
Collaborator

What would you like to be added:
Currently, this yaml

 taskList:
    type: array
    items:
      type: object
      title: TaskItem
      minProperties: 1
      maxProperties: 1
      additionalProperties:
        $ref: '#/$defs/task'


is translated to

@Generated("jsonschema2pojo")
public class TaskItem implements Serializable
{

    @JsonIgnore
    @Valid
    private Map<String, Task> additionalProperties = new LinkedHashMap<String, Task>();
    private final static long serialVersionUID = 2309610577983775837L;

    @JsonAnyGetter
    public Map<String, Task> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Task value) {
        this.additionalProperties.put(name, value);
    }

    public TaskItem withAdditionalProperty(String name, Task value) {
        this.additionalProperties.put(name, value);
        return this;
    }

}

which ideally should be


@Generated("jsonschema2pojo")
public class TaskItem implements Serializable
{

    @JsonIgnore
    @Valid
    private Map<String, Task> additionalProperties = new LinkedHashMap<String, Task>();
    private final static long serialVersionUID = 2309610577983775837L;

    private String name;
    private Task task;
	public Task getTask() {
		return task;
	}
	public void setTask(Task task) {
		this.task = task;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
    
}

Why is this needed:

To make API more usable

@ricardozanini ricardozanini added enhancement New feature or request spec:1.0.0 labels Jun 26, 2024
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 26, 2024
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 27, 2024
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 27, 2024
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 27, 2024
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 28, 2024
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 28, 2024
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
fjtirado added a commit to fjtirado/sdk-java that referenced this issue Jun 28, 2024
ricardozanini added a commit that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spec:1.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants