-
Notifications
You must be signed in to change notification settings - Fork 282
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
$id field is not being preserved #327
Comments
Hello @snaum currently the in-memory |
erosb
added a commit
to erosb/everit-json-schema
that referenced
this issue
Sep 18, 2019
added generic visitSchema() to `Visitor`, which is called by all visit* methods accepting any `Schema` instance initial ToStringVisitor - moved BooleanSchema handling and started ArraySchema made `SpecificationVersion` public so that ToStringVisitor can choose between `"id"` and `"$id"` - requested in everit-org#327
erosb
added a commit
to erosb/everit-json-schema
that referenced
this issue
Sep 19, 2019
Fixing issue everit-org#327 (determining id/$id depending on schema spec version). The $schema value is preserved after parsing as an unprocessedProperty so we use that. The deduced spec version is stored in a visitor field, so the first found $schema value is considered as the spec version for the entire schema document. Also: * printing common properties for EnumSchema * changing ToStringVisitor to use its own #printSchemaMap() because the previously used JSONPrinter#printSchemaMap() created
This is now fixed and released in version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"$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();
`
The text was updated successfully, but these errors were encountered: