-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Description
"$id" field in the schema is being converted to "id".
This is a side effect that is not expected and not documented.
IMO, schema.toString() should use the version to determine whether to print "id" or "$id"
Please see the below unit test to reproduce.
`
public void testPreserveID(){
final JSONObject validSchema1JSON = new JSONObject(validSchema1);
SchemaLoader loader = SchemaLoader.builder().schemaJson(validSchema1JSON).draftV7Support().build();
Schema schema = loader.load().build();
JSONObject resultSchemaJSON = new JSONObject(schema.toString());
JSONObject originalSchemaJSON = new JSONObject(validSchema1);
assertEquals(originalSchemaJSON.get("$id"),resultSchemaJSON.get("id"));
}
`
Metadata
Metadata
Assignees
Labels
No labels