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

Make OperationDetails types more accurate #2733

Closed
t92549 opened this issue Aug 11, 2022 · 1 comment
Closed

Make OperationDetails types more accurate #2733

t92549 opened this issue Aug 11, 2022 · 1 comment

Comments

@t92549
Copy link
Contributor

t92549 commented Aug 11, 2022

Currently, OperationDetails will return an operation's parameters and their types. However, some operation's parameters are listed as Object[] due to multiple setters for serialisation.
For example, the input parameter from GetElements:

{
    "name": "input",
    "className": "java.lang.Object[]",
    "required": false
}

The className should be "uk.gov.gchq.gaffer.data.element.Element[]"

Note, this happens with GetElements and not AddElements due to MultiElementIdInput, so this class could be changed.
Alternatively, OperationDetail to account for this.

This is needed for gchq/gaffer-tools#1023 and gchq/gafferpy#9

@t92549 t92549 added the enhancement Improvement to existing functionality/feature label Aug 11, 2022
@t92549 t92549 added this to the v2.0.0 milestone Aug 11, 2022
@t92549 t92549 added invalid and removed enhancement Improvement to existing functionality/feature labels Sep 23, 2022
@t92549 t92549 removed this from the v2.0.0 milestone Sep 23, 2022
@t92549
Copy link
Contributor Author

t92549 commented Sep 23, 2022

After further digging, it would appear that GetElements input should in fact be of type java.lang.Object[]. This is because you can enter a String for example, and that will be wrapped into an EntitySeed:

@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "class")
@JsonSetter("input")
default void setInputFromVerticesAndIds(final Object[] input) {
setInput(OperationUtil.toElementIds(input));

final GetElements op = new GetElements.Builder()
.input("1", new EntitySeed("2"), new Entity("group1", "3"), new EdgeSeed("4", "5"), new Edge("group", "6", "7", true))
.build();
// Then
assertEquals(
Lists.newArrayList(new EntitySeed("1"), new EntitySeed("2"), new Entity("group1", "3"), new EdgeSeed("4", "5"), new Edge("group", "6", "7", true)),
Lists.newArrayList(op.getInput())
);

@t92549 t92549 closed this as completed Sep 23, 2022
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

No branches or pull requests

1 participant