Open michaelfclarke opened 6 years ago
As a side note, I have fixed the issue locally with the following pattern:
Replacing this code where you have Enums:
public void write(final JsonWriter jsonWriter, final ServerState enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
With the following:
public void write(final JsonWriter jsonWriter, final ServerState enumeration) throws IOException {
if (enumeration != null) {
jsonWriter.value(enumeration.getValue());
} else {
jsonWriter.nullValue();
}
}
This change worked for me, allowing me to optionally provide Server State (and some other Enums that were affected). So, I can submit a pull request with these changes - if you would like?
@michaelfclarke thanks for reporting this in! And please do submit a PR if you have fixed this issue :)
Finally got around to sending in a pull request - only a year later!
I am trying to use the API to create a server, by cloning a template. I believe I am doing the "right" thing, based on this documentation: https://www.upcloud.com/api/1.2.6/8-servers/#create-server
Essentially this is the code I have:
However, there is an issue when actually sending the request to the RESTful API. If I do not include a ServerState value on the Server object, I get a Null Pointer Exception:
If I include a ServerState on the Server object, I get an "UNKNOWN_ATTRIBUTE" response from the server: