lib/avrolution/compatibility_check.rb in avrolution-0.5.0 vs lib/avrolution/compatibility_check.rb in avrolution-0.6.0
- old
+ new
@@ -52,18 +52,25 @@
fullname = schema.fullname
fingerprint = schema.sha256_resolution_fingerprint.to_s(16)
logger.info("Checking compatibility: #{fullname}")
+ return if schema_registered?(fullname, schema)
compatible = schema_registry.compatible?(fullname, schema, 'latest')
if compatible.nil?
# compatible is nil if the subject is not registered
logger.info("... New schema: #{fullname}")
elsif !compatible && !compatibility_fallback(schema, fullname, fingerprint)
incompatible_schemas << file
report_incompatibility(json, schema, fullname, fingerprint)
end
+ end
+
+ def schema_registered?(fullname, schema)
+ schema_registry.lookup_subject_schema(fullname, schema)
+ rescue Excon::Errors::NotFound
+ nil
end
# For a schema that is incompatible with the latest registered schema,
# check if there is a compatibility break defined and check compatibility
# using the level defined by the break.