if a schema id is passed try to replace it with the actual schema

But if that’s not available, use { $ref: schemaId }.
fix search logic for isRegistered()
add tests for isRegistered