Merge pull request 'JSON: Transmit the ID as a string. See commit for the reason.' (#6) from feature/id-as-string into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: java/labyrinth-generator#6
This commit is contained in:
Manuel Friedli 2023-04-16 00:34:26 +02:00
commit 2362365708
3 changed files with 4 additions and 4 deletions

View file

@ -20,7 +20,7 @@ class Generator {
@NonNull @NonNull
JsonLabyrinth generate() { JsonLabyrinth generate() {
final JsonLabyrinth result = new JsonLabyrinth(); final JsonLabyrinth result = new JsonLabyrinth();
result.setId(this.labyrinth.getRandomSeed()); result.setId(String.valueOf(this.labyrinth.getRandomSeed()));
result.setWidth(this.labyrinth.getWidth()); result.setWidth(this.labyrinth.getWidth());
result.setHeight(this.labyrinth.getHeight()); result.setHeight(this.labyrinth.getHeight());
final List<List<JsonCell>> rows = new ArrayList<>(); final List<List<JsonCell>> rows = new ArrayList<>();

View file

@ -39,7 +39,7 @@ public class JsonRenderer implements Renderer<String> {
rows.get(0).add(cell); rows.get(0).add(cell);
// Wrap it all in an instance of JsonLabyrinth. // Wrap it all in an instance of JsonLabyrinth.
final JsonLabyrinth jsonLabyrinth = new JsonLabyrinth(); final JsonLabyrinth jsonLabyrinth = new JsonLabyrinth();
jsonLabyrinth.setId(0L); jsonLabyrinth.setId("0");
jsonLabyrinth.setGrid(rows); jsonLabyrinth.setGrid(rows);
return jsonLabyrinth; return jsonLabyrinth;
} }

View file

@ -12,8 +12,8 @@
], ],
"properties": { "properties": {
"id": { "id": {
"type": "integer", "type": "string",
"existingJavaType": "java.lang.Long" "description": "64 bit precision signed integer value. Transmitted as string, because ECMAScript (browsers) don't normally handle 64 bit integers well, as the ECMAScript 'number' type is a 64 bit signed double value, leaving only 53 bits for the integer part, thus losing precision."
}, },
"width": { "width": {
"type": "integer", "type": "integer",