createSchema method
Creates a schema definition.
May throw ServiceUnavailableException. May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException.
Parameter content
:
The source of the schema definition.
Parameter registryName
:
The name of the registry.
Parameter schemaName
:
The name of the schema.
Parameter type
:
The type of schema.
Parameter description
:
A description of the schema.
Parameter tags
:
Tags associated with the schema.
Implementation
Future<CreateSchemaResponse> createSchema({
required String content,
required String registryName,
required String schemaName,
required Type type,
String? description,
Map<String, String>? tags,
}) async {
ArgumentError.checkNotNull(content, 'content');
_s.validateStringLength(
'content',
content,
1,
100000,
isRequired: true,
);
ArgumentError.checkNotNull(registryName, 'registryName');
ArgumentError.checkNotNull(schemaName, 'schemaName');
ArgumentError.checkNotNull(type, 'type');
_s.validateStringLength(
'description',
description,
0,
256,
);
final $payload = <String, dynamic>{
'Content': content,
'Type': type.toValue(),
if (description != null) 'Description': description,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/v1/registries/name/${Uri.encodeComponent(registryName)}/schemas/name/${Uri.encodeComponent(schemaName)}',
exceptionFnMap: _exceptionFns,
);
return CreateSchemaResponse.fromJson(response);
}