Skip to content

Commit 0bf87de

Browse files
committed
Change Parameters/items to refer to parameter definition
1 parent 08a8ac3 commit 0bf87de

File tree

1 file changed

+332
-0
lines changed
  • Microsoft.PowerShell.Crescendo/schemas

1 file changed

+332
-0
lines changed
Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
{
2+
"definitions": {
3+
"parameter": {
4+
"description": "The description of a parameter.",
5+
"required": ["Name"],
6+
"properties": {
7+
"ParameterType": {
8+
"type": "string",
9+
"description": "This the type of the parameter. It should represent an actual type. The default value is 'object'."
10+
},
11+
"Position": {
12+
"type": "integer",
13+
"description": "The position of the parameter."
14+
},
15+
"Name": {
16+
"type": "string",
17+
"description": "The name of the parameter that PowerShell will use."
18+
},
19+
"OriginalName": {
20+
"type": "string",
21+
"description": "The original parameter name used by the native command. If NoGap is used, include the separator in the name. 'parameter=' for parameter=value."
22+
},
23+
"OriginalText": {
24+
"type": "string",
25+
"description": "The original help text for the native command parameter."
26+
},
27+
"ApplyToExecutable": {
28+
"type": "boolean",
29+
"description": "Whether this parameter is placed before OriginalCommandElements. The default is false."
30+
},
31+
"ExcludeAsArgument": {
32+
"type": "boolean",
33+
"description": "Whether this parameter provided to the application. The parameter value can be used in the output handler. The default is false."
34+
},
35+
"Description": {
36+
"type": "string",
37+
"description": "The description of the parameter, this will be used by help."
38+
},
39+
"DefaultValue": {
40+
"type": "string",
41+
"description": "The default value for the parameter."
42+
},
43+
"DefaultMissingValue": {
44+
"type": "string",
45+
"description": "The default value provided if the parameter is not used."
46+
},
47+
"AdditionalParameterAttributes": {
48+
"type": "array",
49+
"description": "Additional parameter attributes used by PowerShell. This will take the form of a standard script parameter attribute.",
50+
"items": {
51+
"type": "string"
52+
}
53+
},
54+
"Mandatory": {
55+
"type": "boolean",
56+
"description": "A boolean indicating whether this parameter is mandatory."
57+
},
58+
"ParameterSetName": {
59+
"type": "array",
60+
"description": "The names of the parameter set for this parameter.",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"Aliases": {
66+
"type": "array",
67+
"items": {
68+
"type": "string"
69+
},
70+
"description": "A list of aliases for the cmdlet."
71+
},
72+
"OriginalPosition": {
73+
"type": "integer",
74+
"description": "The original parameter position for the native executable. This is used to properly order parameters when calling the native command."
75+
},
76+
"ValueFromPipeline": {
77+
"type": "boolean",
78+
"description": "The value for this parameter is taken from the pipeline."
79+
},
80+
"NoGap": {
81+
"type": "boolean",
82+
"description": "When constructing the native parameter and value do not separate with a space. Used for native parameters that look like parameter=value."
83+
},
84+
"ValueFromPipelineByPropertyName": {
85+
"type": "boolean",
86+
"description": "When are assigning a value to the parameter from a piped object, use the same property as the parameter name."
87+
},
88+
"ValueFromRemainingArguments": {
89+
"type": "boolean",
90+
"description": "Assign the remaining values to the parameter."
91+
},
92+
"ArgumentTransform": {
93+
"description": "A scriptblock, function, or script which will be used to transform the argument value.",
94+
"type": "string"
95+
},
96+
"ArgumentTransformType": {
97+
"type": "string",
98+
"enum": ["Inline", "Function","Script"],
99+
"description": "The type of argument transform script, by default this is 'Inline'."
100+
}
101+
}
102+
},
103+
"command": {
104+
"description": "A collection of Crescendo configurations.",
105+
"required": [ "Verb", "Noun", "OriginalName" ],
106+
"properties": {
107+
"Verb": {
108+
"type": "string",
109+
"enum": [
110+
"Add","Approve","Assert",
111+
"Backup","Block","Build",
112+
"Checkpoint","Clear","Close","Compare","Complete","Compress","Confirm","Connect","Convert","ConvertFrom","ConvertTo","Copy",
113+
"Debug","Deny","Deploy","Disable","Disconnect","Dismount",
114+
"Edit","Enable","Enter","Exit","Expand","Export",
115+
"Find","Format",
116+
"Get","Grant","Group",
117+
"Hide",
118+
"Import","Initialize","Install","Invoke",
119+
"Join",
120+
"Limit","Lock",
121+
"Measure","Merge","Mount","Move",
122+
"New",
123+
"Open","Optimize","Out",
124+
"Ping","Pop","Protect","Publish","Push",
125+
"Read","Receive","Redo","Register","Remove","Rename","Repair","Request","Reset","Resize","Resolve","Restart","Restore","Resume","Revoke",
126+
"Save","Search","Select","Send","Set","Show","Skip","Split","Start","Step","Stop","Submit","Suspend","Switch","Sync",
127+
"Test","Trace",
128+
"Unblock","Undo","Uninstall","Unlock","Unprotect","Unpublish","Unregister","Update","Use",
129+
"Wait","Watch","Write"
130+
],
131+
"description" : "The verb of the cmdlet."
132+
},
133+
"Elevation": {
134+
"type": "object",
135+
"description": "When privilege elevation is required to run the command. Provide ElevationCommand and optional arguments.",
136+
"required": ["Command"],
137+
"properties": {
138+
"Command": {
139+
"type": "string",
140+
"description": "The command which performs the elevation. Windows elevation may be done with the built-in function Invoke-WindowsNativeAppWithElevation."
141+
},
142+
"Arguments": {
143+
"type": "array",
144+
"items": { "$ref": "#/definitions/parameter" },
145+
"description": "Additional arguments required by the elevation command."
146+
}
147+
}
148+
},
149+
"Noun": {
150+
"type": "string",
151+
"description" : "The noun of the cmdlet."
152+
},
153+
"Platform": {
154+
"type": "array",
155+
"minItems": 1,
156+
"maxItems": 3,
157+
"uniqueItems": true,
158+
"items": {
159+
"type": "string",
160+
"enum": [ "Windows", "Linux", "MacOS" ]
161+
},
162+
"description" : "The platform where the function will run, this may be 'Windows','Linux', or 'MacOS' in any combination. The default is all three values."
163+
},
164+
"OriginalName": {
165+
"type": "string",
166+
"description" : "The native command to be called by the function."
167+
},
168+
169+
"OutputHandlers": {
170+
"type": "array",
171+
"description": "Converts the text output of the native command into an object. Each output handler is associated with a parameter set name.",
172+
"items": {
173+
"type": "object",
174+
"properties": {
175+
"ParameterSetName": {
176+
"type": "string",
177+
"description": "The name of the parameter set which will use the handler."
178+
},
179+
"Handler": {
180+
"type": "string",
181+
"description": "This is the code which converts the output to objects."
182+
},
183+
"HandlerType": {
184+
"type": "string",
185+
"enum": ["Inline", "Function","Script", "ByPass"],
186+
"description": "The type of handler, by default this is 'Inline'. If set to 'ByPass' no handler or error handling will be done."
187+
},
188+
"StreamOutput": {
189+
"type": "boolean",
190+
"description": "When used, output will be piped as a stream to the output handler."
191+
}
192+
},
193+
"if": {
194+
"properties": {
195+
"HandlerType": {
196+
"enum": [ "ByPass" ]
197+
}
198+
}
199+
},
200+
"then": {
201+
"required": ["ParameterSetName"]
202+
},
203+
"else": {
204+
"required": ["ParameterSetName", "Handler" ]
205+
}
206+
}
207+
},
208+
"OriginalCommandElements": {
209+
"type": "array",
210+
"items": {
211+
"type": "string"
212+
},
213+
"description": "Additional elements to be added to the invocation. This is for arguments provided to a Native application which are not part of the parameters."
214+
},
215+
"Aliases": {
216+
"type": "array",
217+
"description" : "Aliases to the function that will be created.",
218+
"items": {
219+
"type": "string"
220+
}
221+
},
222+
"DefaultParameterSetName": {
223+
"type": "string",
224+
"description": "The default parameter set name for the function."
225+
226+
},
227+
"ConfirmImpact": {
228+
"type": "string",
229+
"enum": ["None", "Low","Medium","High"],
230+
"description": "A string indicating the value of Confirm Impact. If not present, this attribute will not be added to the cmdlet declaration."
231+
},
232+
"SupportsShouldProcess": {
233+
"type": "boolean",
234+
"description": "A boolean indicating whether this command supports ShouldProcess."
235+
},
236+
"SupportsTransactions": {
237+
"type": "boolean",
238+
"description": "A boolean indicating whether this command supports transactions."
239+
},
240+
"Description": {
241+
"description": "The description of the cmdlet.",
242+
"type": "string"
243+
},
244+
"Usage": {
245+
"description": "Information which explains how to use this command.",
246+
"type": "object",
247+
"required": [ "Synopsis" ],
248+
"properties": {
249+
"Synopsis": {
250+
"description": "The synopsis on how to use this command.",
251+
"type": "string"
252+
},
253+
"SupportsFlags": {
254+
"description": "Unused.",
255+
"type": "boolean"
256+
},
257+
"HasOptions": {
258+
"description": "Unused.",
259+
"type": "boolean"
260+
},
261+
"OriginalText": {
262+
"type": "array",
263+
"items": {
264+
"type": "string"
265+
},
266+
"description": "The original text for the command help. Usually generated by command -?."
267+
}
268+
}
269+
},
270+
"Parameters": {
271+
"type": "array",
272+
"description": "The parameters for the function.",
273+
"items": { "$ref": "#/definitions/parameter" },
274+
},
275+
"Examples": {
276+
"description": "Examples for the command.",
277+
"type": "array",
278+
"items": {
279+
"type": "object",
280+
"required": [ "Command", "Description" ],
281+
"properties": {
282+
"Command": {
283+
"description": "The command for the example.",
284+
"type": "string"
285+
},
286+
"OriginalCommand": {
287+
"description": "The original command for the example.",
288+
"type": "string"
289+
},
290+
"Description": {
291+
"description": "The description of the example.",
292+
"type": "string"
293+
}
294+
}
295+
}
296+
},
297+
"OriginalText": {
298+
"description": "The original help text of the native command.",
299+
"type": "string"
300+
},
301+
"HelpLinks": {
302+
"description": "Help links for the command.",
303+
"type": "array",
304+
"items": {
305+
"type": "string"
306+
}
307+
},
308+
"NoInvocation": {
309+
"type":"boolean",
310+
"description": "This option returns the arguments which would be sent to the native executable. If used, the native application will not be invoked."
311+
}
312+
},
313+
"additionalProperties": false
314+
}
315+
},
316+
"type": "object",
317+
"$schema": "http://json-schema.org/draft-07/schema#",
318+
"$id": "https://microsoft.com/powershell/crescendo",
319+
"title": "JSON schema for PowerShell Crescendo files",
320+
"properties": {
321+
"$schema": {
322+
"type": "string"
323+
},
324+
"Commands":{
325+
"description": "The Crescendo command definitions.",
326+
"type": "array",
327+
"items": {
328+
"$ref": "#/definitions/command"
329+
}
330+
}
331+
}
332+
}

0 commit comments

Comments
 (0)