Skip to content

Commit 87589da

Browse files
committed
Add support for dynamic parameter mappings in authorization templates (Only const was supported)
1 parent f62c397 commit 87589da

3 files changed

Lines changed: 22 additions & 34 deletions

File tree

src/Dibix.Sdk.CodeGeneration/Registration/ControllerDefinitionProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ private void ReadControllerAction(ControllerDefinition controller, JObject actio
119119
if (childRouteProperty != null)
120120
{
121121
string childRouteValue = (string)childRouteProperty.Value;
122-
SourceLocation childRoutePropertyLocation = childRouteProperty.GetSourceInfo();
123122
childRoute = childRouteProperty?.Value.ToToken(childRouteValue);
124123
pathParameters = new ReadOnlyDictionary<string, PathParameter>(CollectPathParameters(childRouteProperty, childRouteValue).ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase));
125124
}

src/Dibix.Sdk.CodeGeneration/Schema/dibix.endpoints.schema.json

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,24 @@
117117
}
118118
]
119119
},
120+
"ParameterMapping": {
121+
"anyOf": [
122+
{
123+
"$ref": "#/definitions/Source"
124+
},
125+
{
126+
"$ref": "#/definitions/ItemsPropertySource"
127+
},
128+
{
129+
"$ref": "#/definitions/BodySource"
130+
}
131+
]
132+
},
120133
"ParameterMappings": {
121134
"type": "object",
122135
"patternProperties": {
123136
"^[a-z]+$": {
124-
"anyOf": [
125-
{
126-
"$ref": "#/definitions/Source"
127-
},
128-
{
129-
"$ref": "#/definitions/ItemsPropertySource"
130-
},
131-
{
132-
"$ref": "#/definitions/BodySource"
133-
}
134-
]
137+
"$ref": "#/definitions/ParameterMapping"
135138
}
136139
},
137140
"minProperties": 1,
@@ -174,18 +177,21 @@
174177
}
175178
]
176179
},
180+
"AuthorizationTemplateName": {
181+
"type": "string",
182+
"pattern": "^[A-Z]([A-Za-z]+)?$"
183+
},
177184
"AuthorizationTemplateReference": {
178185
"anyOf": [
179186
{
180-
"type": "object",
181187
"properties": {
182188
"name": {
183-
"$ref": "#/definitions/NameIdentifier"
189+
"$ref": "#/definitions/AuthorizationTemplateName"
184190
}
185191
},
186192
"patternProperties": {
187-
"^[a-z]+$": {
188-
"$ref": "#/definitions/ConstantSource"
193+
"^(?!name$)[a-z]+$": {
194+
"$ref": "#/definitions/ParameterMapping"
189195
}
190196
},
191197
"required": [
@@ -194,7 +200,7 @@
194200
"additionalProperties": false
195201
},
196202
{
197-
"$ref": "#/definitions/NameIdentifier"
203+
"$ref": "#/definitions/AuthorizationTemplateName"
198204
}
199205
]
200206
},

src/Dibix.Sdk/Schema/dibix.configuration.schema.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@
2222
}
2323
]
2424
},
25-
"ConstantSource": {
26-
"anyOf": [
27-
{
28-
"type": "boolean"
29-
},
30-
{
31-
"type": "number"
32-
},
33-
{
34-
"type": "string",
35-
"pattern": "^[^.]+$"
36-
},
37-
{
38-
"type": "null"
39-
}
40-
]
41-
},
4225
"PropertySource": {
4326
"anyOf": [
4427
{

0 commit comments

Comments
 (0)