Tweak `x-ms-client-default` docs (#4334)

This commit is contained in:
Timothee Guerin 2021-10-08 13:03:32 -07:00 коммит произвёл GitHub
Родитель 9d3554b656
Коммит a72bff32c1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 29 добавлений и 11 удалений

Просмотреть файл

@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@autorest/core",
"comment": "**Fix** --help crash",
"type": "patch"
}
],
"packageName": "@autorest/core",
"email": "tiguerin@microsoft.com"
}

Просмотреть файл

@ -850,10 +850,13 @@ Note: The extension is not tight to this particular scenario (you could model an
## x-ms-client-default
Set the default value for a property or a parameter.
Set the default value for a property or a parameter on the client.
With this extension, you can set a default value for a property or parameter that is independent of how the property / parameter's schema is handling a default.
With this extension, you can set a default value for a property or parameter that is independent of how the property / parameter's schema is handling a default. This is different than the `default` value
you can specify
**`x-ms-client-default` vs `default`:**
- `default`: This represent the server default. From the point of view of the client this is just documentation, it will be ignored.
- `x-ms-client-default`: This represent the default on the client. It can be used to make a required property optional.
**Parent element**: [Parameter Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject) or [Property on the Schema Definition](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject).

Просмотреть файл

@ -152,7 +152,9 @@ export class AutoRest extends EventEmitter {
// if this is using perform-load we don't need to require files.
// if it's using batch, we might not have files in the main body
if (view.config.raw["perform-load"] !== false) {
return new Exception("No input files provided.\n\nUse --help to get help information.");
return new Exception(
"No input files provided.\n\nUse --help to get help information or see https://aka.ms/autorest/cli for additional documentation",
);
}
}
}

Просмотреть файл

@ -9,13 +9,15 @@ import { PipelinePlugin } from "../pipeline/common";
/* @internal */
export function createHelpPlugin(): PipelinePlugin {
return async (config) => {
const help: { [helpKey: string]: any } = config.GetEntry(<any>"help-content");
for (const helpKey of Object.keys(help).sort()) {
config.GeneratedFile.Dispatch({
type: "help",
uri: `${helpKey}.json`,
content: JSON.stringify(help[helpKey]),
});
const help: { [helpKey: string]: any } = config.GetEntry("help-content");
if (help) {
for (const helpKey of Object.keys(help).sort()) {
config.GeneratedFile.Dispatch({
type: "help",
uri: `${helpKey}.json`,
content: JSON.stringify(help[helpKey]),
});
}
}
return new QuickDataSource([]);
};