Skip to content

Commit 71ceebe

Browse files
authored
Apiscenario auth (#20589)
* define authentication * remove shareScope support * support overriding operationId * align with autorest auth options
1 parent f7a7c19 commit 71ceebe

File tree

2 files changed

+95
-13
lines changed

2 files changed

+95
-13
lines changed

documentation/api-scenario/references/ApiScenarioDefinition.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ It defines one API scenario that could go through on its own.
8181
```yaml
8282
scenario: quickStart
8383
description: Quick start with AppConfiguration ConfigurationStores
84-
shareScope: true
8584
steps:
8685
- step: Operations_CheckNameAvailability
8786
operationId: Operations_CheckNameAvailability
@@ -101,13 +100,6 @@ variables:
101100
- **description**
102101
- **Type:** Optional, String
103102
- Description for this API scenario.
104-
- **shareScope**
105-
- **Type:** Optional, Boolean or String
106-
- **Default:** true
107-
- Describe how the scope (ResourceGroup if scope is ResourceGroup) could be shared with other scenarios. If true or the same string value for different API scenario, they share the same scope, which means:
108-
- These API scenarios will run under the same scope (e.g. ResourceGroup).
109-
- **prepareSteps** and **cleanUpSteps** will run only once in the scope. The variables will be shared.
110-
- By default all the API scenario in one definition file will be launched in the same scope. If shareScope is false, the API scenarios will not share anything with others in the same file.
111103
- **variables**
112104
- **Type:** Optional, Map of Strings or Variables
113105
- See [Variables](./Variables.md)

documentation/api-scenario/references/v1.2/schema.json

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
],
1313
"default": "ResourceGroup"
1414
},
15+
"authentication": {
16+
"$ref": "#/definitions/Authentication"
17+
},
1518
"variables": {
1619
"$ref": "#/definitions/Variables"
1720
},
@@ -47,6 +50,82 @@
4750
"type": "string",
4851
"pattern": "^[A-Za-z_$][A-Za-z0-9_-]*$"
4952
},
53+
"Authentication": {
54+
"type": "object",
55+
"properties": {
56+
"type": {
57+
"type": "string",
58+
"enum": [
59+
"AADToken",
60+
"AzureKey",
61+
"None"
62+
],
63+
"default": "AADToken"
64+
}
65+
},
66+
"required": [
67+
"type"
68+
],
69+
"allOf": [
70+
{
71+
"if": {
72+
"properties": {
73+
"type": {
74+
"const": "AADToken"
75+
}
76+
}
77+
},
78+
"then": {
79+
"properties": {
80+
"type": {},
81+
"scope": {
82+
"type": "string",
83+
"description": "The resource identifier (application ID URI) of the resource you want, affixed with the .default suffix",
84+
"examples": [
85+
"https://management.azure.com/.default",
86+
"https://storage.azure.com/.default"
87+
]
88+
}
89+
},
90+
"required": [
91+
"scope"
92+
],
93+
"additionalProperties": false
94+
},
95+
"else": {
96+
"if": {
97+
"properties": {
98+
"type": {
99+
"const": "AzureKey"
100+
}
101+
}
102+
},
103+
"then": {
104+
"properties": {
105+
"type": {},
106+
"key": {
107+
"type": "string"
108+
},
109+
"headerName": {
110+
"type": "string",
111+
"default": "Authorization"
112+
}
113+
},
114+
"required": [
115+
"key"
116+
],
117+
"additionalProperties": false
118+
},
119+
"else": {
120+
"properties": {
121+
"type": {}
122+
},
123+
"additionalProperties": false
124+
}
125+
}
126+
}
127+
]
128+
},
50129
"JsonPointer": {
51130
"type": "string",
52131
"description": "JSON Pointer described by RFC 6901, e.g. /foo/bar",
@@ -274,14 +353,13 @@
274353
"type": "string",
275354
"description": "A long description of the scenario"
276355
},
356+
"authentication": {
357+
"$ref": "#/definitions/Authentication",
358+
"description": "Authentication method to use for the scenario"
359+
},
277360
"variables": {
278361
"$ref": "#/definitions/Variables"
279362
},
280-
"shareScope": {
281-
"type": "boolean",
282-
"description": "Whether to share the scope and prepareSteps with other scenarios",
283-
"default": true
284-
},
285363
"steps": {
286364
"type": "array",
287365
"items": {
@@ -334,6 +412,9 @@
334412
}
335413
],
336414
"properties": {
415+
"authentication": {
416+
"$ref": "#/definitions/Authentication"
417+
},
337418
"outputVariables": {
338419
"type": "object",
339420
"propertyNames": {
@@ -416,6 +497,7 @@
416497
},
417498
"step": {},
418499
"description": {},
500+
"authentication": {},
419501
"variables": {},
420502
"outputVariables": {}
421503
},
@@ -436,6 +518,13 @@
436518
"type": "string",
437519
"format": "uri-reference"
438520
},
521+
"operationId": {
522+
"type": "string"
523+
},
524+
"readmeTag": {
525+
"type": "string",
526+
"format": "uri-reference"
527+
},
439528
"requestUpdate": {
440529
"type": "array",
441530
"description": "Update request parameters",
@@ -454,6 +543,7 @@
454543
},
455544
"step": {},
456545
"description": {},
546+
"authentication": {},
457547
"variables": {},
458548
"outputVariables": {}
459549
},

0 commit comments

Comments
 (0)