registerSchemaVersion method

Future<RegisterSchemaVersionResponse> registerSchemaVersion({
  1. required String schemaDefinition,
  2. required SchemaId schemaId,
})

Adds a new version to the existing schema. Returns an error if new version of schema does not meet the compatibility requirements of the schema set. This API will not create a new schema set and will return a 404 error if the schema set is not already present in the Schema Registry.

If this is the first schema definition to be registered in the Schema Registry, this API will store the schema version and return immediately. Otherwise, this call has the potential to run longer than other operations due to compatibility modes. You can call the GetSchemaVersion API with the SchemaVersionId to check compatibility modes.

If the same schema definition is already stored in Schema Registry as a version, the schema ID of the existing schema is returned to the caller.

May throw AccessDeniedException. May throw ConcurrentModificationException. May throw EntityNotFoundException. May throw InternalServiceException. May throw InvalidInputException. May throw ResourceNumberLimitExceededException.

Parameter schemaDefinition : The schema definition using the DataFormat setting for the SchemaName.

Parameter schemaId : This is a wrapper structure to contain schema identity fields. The structure contains:

  • SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema. Either SchemaArn or SchemaName and RegistryName has to be provided.
  • SchemaId$SchemaName: The name of the schema. Either SchemaArn or SchemaName and RegistryName has to be provided.

Implementation

Future<RegisterSchemaVersionResponse> registerSchemaVersion({
  required String schemaDefinition,
  required SchemaId schemaId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.RegisterSchemaVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SchemaDefinition': schemaDefinition,
      'SchemaId': schemaId,
    },
  );

  return RegisterSchemaVersionResponse.fromJson(jsonResponse.body);
}