Skip to content

avro schema client bug | not using latest schema but reporting latest version #48

Description

@nhomble

We see an issue where producers of data are using version 1 of a schema when the registry has up to version 2 (backwards compatible). When the spring cloud client gets the available schemas for the subject, it picks the latest version but it doesn't change the actual schema object.

740c811

	ResponseEntity<List> response = this.template.getForEntity(this.endpoint + "/subjects/" + subject + "/versions",
			List.class);
        final List body = response.getBody();
	if (!CollectionUtils.isEmpty(body)) {
		version = (Integer) body.get(body.size() - 1);
	}

This seems like incorrect behavior. It makes sense to use the latest version because of compatibility assertions but when you do, you need to use the actual schema for that id. For comparison, we can see confluent's serializer

      } else if (useLatestVersion) {
        restClientErrorMsg = "Error retrieving latest version of Avro schema";
        schema = (AvroSchema) lookupLatestVersion(subject, schema);
        id = schemaRegistry.getId(subject, schema);
      }

here they get both latest id and version while writing. But in the spring cloud code, we are only using the List.class response to get the size of the list (number of schemas).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions