acrites commented on code in PR #35597: URL: https://github.com/apache/beam/pull/35597#discussion_r2208155037
########## sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/JsonSchemaConversionTest.java: ########## @@ -285,24 +287,31 @@ public void testArrayWithNestedRefsBeamSchema() throws IOException { String stringJsonSchema = new String(ByteStreams.toByteArray(inputStream), "UTF-8"); Schema parsedSchema = JsonUtils.beamSchemaFromJsonSchema(stringJsonSchema); - assertThat(parsedSchema.getFieldNames(), containsInAnyOrder("vegetables")); - assertThat( - parsedSchema.getFields().stream().map(Schema.Field::getType).collect(Collectors.toList()), - containsInAnyOrder( - Schema.FieldType.array( - Schema.FieldType.row( - Schema.of( - Schema.Field.of("veggieName", Schema.FieldType.STRING), - Schema.Field.of("veggieLike", Schema.FieldType.BOOLEAN), - Schema.Field.nullable( - "origin", - Schema.FieldType.row( - Schema.of( - Schema.Field.nullable("country", Schema.FieldType.STRING), - Schema.Field.nullable("town", Schema.FieldType.STRING), - Schema.Field.nullable( - "region", Schema.FieldType.STRING))))))) - .withNullable(true))); + assertEquals("vegetables", Iterables.getOnlyElement(parsedSchema.getFieldNames())); + Schema.Field field = parsedSchema.getField("vegetables"); + + // test using equivalency, which permits out-of-orderness + assertTrue( + field + .getType() + .equivalent( + Schema.FieldType.array( + Schema.FieldType.row( + Schema.of( + Schema.Field.of("veggieName", Schema.FieldType.STRING), Review Comment: Do we want to keep the test checking that these first two fields occur in this order (which I think is guaranteed since they're required). We only want to relax the ordering of the subfields in "origin". -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org