@Override public CompatibilityResult checkCompatibility(String schemaBranchName, String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException { return schemaRegistry.checkCompatibility(schemaBranchName, schemaName, toSchemaText); }
@Override public CompatibilityResult checkCompatibility(String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException { return schemaRegistry.checkCompatibility(schemaName, toSchemaText); }
@POST @Path("/schemas/{name}/compatibility") @ApiOperation(value = "Checks if the given schema text is compatible with all the versions of the schema identified by the name", response = CompatibilityResult.class, tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response checkCompatibilityWithSchema(@QueryParam("branch") @DefaultValue(MASTER_BRANCH) String schemaBranchName, @ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @ApiParam(value = "schema text", required = true) String schemaText) { Response response; try { CompatibilityResult compatibilityResult = schemaRegistry.checkCompatibility(schemaBranchName, schemaName, schemaText); response = WSUtils.respondEntity(compatibilityResult, Response.Status.OK); } catch (SchemaNotFoundException e) { LOG.error("No schemas found with schemakey: [{}]", schemaName, e); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while checking compatibility with versions of schema with [{}] for given schema text [{}]", schemaName, schemaText, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@POST @Path("/schemas/{name}/compatibility") @ApiOperation(value = "Checks if the given schema text is compatible with all the versions of the schema identified by the name", response = CompatibilityResult.class, tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response checkCompatibilityWithSchema(@QueryParam("branch") @DefaultValue(MASTER_BRANCH) String schemaBranchName, @ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @ApiParam(value = "schema text", required = true) String schemaText) { Response response; try { CompatibilityResult compatibilityResult = schemaRegistry.checkCompatibility(schemaBranchName, schemaName, schemaText); response = WSUtils.respondEntity(compatibilityResult, Response.Status.OK); } catch (SchemaNotFoundException e) { LOG.error("No schemas found with schemakey: [{}]", schemaName, e); response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } catch (SchemaBranchNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, e.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while checking compatibility with versions of schema with [{}] for given schema text [{}]", schemaName, schemaText, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@Override public boolean isCompatibleWithAllVersions(String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException { return schemaRegistry.checkCompatibility(schemaName, toSchemaText).isCompatible(); }