5
5
use Assert \Assert ;
6
6
use FlixTech \SchemaRegistryApi \Schema \AvroReference ;
7
7
use GuzzleHttp \Psr7 \Request ;
8
- use GuzzleHttp \UriTemplate ;
9
8
use Psr \Http \Message \RequestInterface ;
10
9
use const FlixTech \SchemaRegistryApi \Constants \ACCEPT_HEADER ;
11
10
use const FlixTech \SchemaRegistryApi \Constants \COMPATIBILITY_BACKWARD ;
@@ -32,7 +31,7 @@ function allSubjectVersionsRequest(string $subjectName): RequestInterface
32
31
{
33
32
return new Request (
34
33
'GET ' ,
35
- ( new UriTemplate ())-> expand ( 'subjects/{name} /versions ' , [ ' name ' => $ subjectName] ),
34
+ sprintf ( 'subjects/%s /versions ' , $ subjectName ),
36
35
ACCEPT_HEADER
37
36
);
38
37
}
@@ -41,9 +40,10 @@ function singleSubjectVersionRequest(string $subjectName, string $versionId): Re
41
40
{
42
41
return new Request (
43
42
'GET ' ,
44
- (new UriTemplate ())->expand (
45
- 'subjects/{name}/versions/{id} ' ,
46
- ['name ' => $ subjectName , 'id ' => $ versionId ]
43
+ sprintf (
44
+ 'subjects/%s/versions/%s ' ,
45
+ $ subjectName ,
46
+ $ versionId ,
47
47
),
48
48
ACCEPT_HEADER
49
49
);
@@ -53,7 +53,7 @@ function registerNewSchemaVersionWithSubjectRequest(string $schema, string $subj
53
53
{
54
54
return new Request (
55
55
'POST ' ,
56
- ( new UriTemplate ())-> expand ( 'subjects/{name} /versions ' , [ ' name ' => $ subjectName] ),
56
+ sprintf ( 'subjects/%s /versions ' , $ subjectName ),
57
57
CONTENT_TYPE_HEADER + ACCEPT_HEADER ,
58
58
prepareJsonSchemaForTransfer (validateSchemaStringAsJson ($ schema ), ...$ references )
59
59
);
@@ -63,9 +63,10 @@ function checkSchemaCompatibilityAgainstVersionRequest(string $schema, string $s
63
63
{
64
64
return new Request (
65
65
'POST ' ,
66
- (new UriTemplate ())->expand (
67
- 'compatibility/subjects/{name}/versions/{version} ' ,
68
- ['name ' => $ subjectName , 'version ' => $ versionId ]
66
+ sprintf (
67
+ 'compatibility/subjects/%s/versions/%s ' ,
68
+ $ subjectName ,
69
+ $ versionId ,
69
70
),
70
71
CONTENT_TYPE_HEADER + ACCEPT_HEADER ,
71
72
prepareJsonSchemaForTransfer (validateSchemaStringAsJson ($ schema ))
@@ -76,7 +77,7 @@ function checkIfSubjectHasSchemaRegisteredRequest(string $subjectName, string $s
76
77
{
77
78
return new Request (
78
79
'POST ' ,
79
- ( new UriTemplate ())-> expand ( 'subjects/{name} ' , [ ' name ' => $ subjectName] ),
80
+ sprintf ( 'subjects/%s ' , $ subjectName ),
80
81
CONTENT_TYPE_HEADER + ACCEPT_HEADER ,
81
82
prepareJsonSchemaForTransfer (validateSchemaStringAsJson ($ schema ))
82
83
);
@@ -86,7 +87,7 @@ function schemaRequest(string $id): RequestInterface
86
87
{
87
88
return new Request (
88
89
'GET ' ,
89
- ( new UriTemplate ())-> expand ( 'schemas/ids/{id} ' , [ ' id ' => $ id] ),
90
+ sprintf ( 'schemas/ids/%s ' , $ id ),
90
91
ACCEPT_HEADER
91
92
);
92
93
}
@@ -114,7 +115,7 @@ function subjectCompatibilityLevelRequest(string $subjectName): RequestInterface
114
115
{
115
116
return new Request (
116
117
'GET ' ,
117
- ( new UriTemplate ())-> expand ( 'config/{subject} ' , [ ' subject ' => $ subjectName] ),
118
+ sprintf ( 'config/%s ' , $ subjectName ),
118
119
ACCEPT_HEADER
119
120
);
120
121
}
@@ -123,7 +124,7 @@ function changeSubjectCompatibilityLevelRequest(string $subjectName, string $lev
123
124
{
124
125
return new Request (
125
126
'PUT ' ,
126
- ( new UriTemplate ())-> expand ( 'config/{subject} ' , [ ' subject ' => $ subjectName] ),
127
+ sprintf ( 'config/%s ' , $ subjectName ),
127
128
ACCEPT_HEADER ,
128
129
prepareCompatibilityLevelForTransport (validateCompatibilityLevel ($ level ))
129
130
);
@@ -208,7 +209,7 @@ function deleteSubjectRequest(string $subjectName): RequestInterface
208
209
{
209
210
return new Request (
210
211
'DELETE ' ,
211
- ( new UriTemplate ())-> expand ( 'subjects/{name} ' , [ ' name ' => $ subjectName] ),
212
+ sprintf ( 'subjects/%s ' , $ subjectName ),
212
213
ACCEPT_HEADER
213
214
);
214
215
}
@@ -222,7 +223,7 @@ function deleteSubjectVersionRequest(string $subjectName, string $versionId): Re
222
223
{
223
224
return new Request (
224
225
'DELETE ' ,
225
- ( new UriTemplate ())-> expand ( 'subjects/{name} /versions/{version} ' , [ ' name ' => $ subjectName , ' version ' => $ versionId] ),
226
+ sprintf ( 'subjects/%s /versions/%s ' , $ subjectName , $ versionId ),
226
227
ACCEPT_HEADER
227
228
);
228
229
}
0 commit comments