* help content to config

* regen
This commit is contained in:
Johannes Bader 2017-11-20 16:02:23 -08:00 коммит произвёл GitHub
Родитель 587871043e
Коммит 127b4a5d55
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 92 добавлений и 179 удалений

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

@ -66,11 +66,11 @@
--azureresourceschema generate Azure resource schemas
--azureresourceschema generate Azure resource schemas
--azureresourceschema generate Azure resource schemas
--base-folder path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder=<string> path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder=<string> path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder=<string> path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder=<string> path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--base-folder=<string> path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise
--csharp generate C# client code
--csharp generate C# client code
--csharp generate C# client code

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

@ -79,8 +79,6 @@ output-artifact:
- code-model-v1.yaml
- pipeline.yaml
- configuration.yaml
- null
- help
- source-file-csharp
- source-file-jsonrpcclient
output-folder: generated
@ -134,12 +132,6 @@ pipeline:
scope: scope-transform-string
suffixes:
- ''
help/help-autorest:
scope: help
suffixes: []
help/help-autorest-core:
scope: help
suffixes: []
jsonrpcclient/emitter:
input: transform
scope: scope-jsonrpcclient/emitter

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

@ -9,163 +9,16 @@ import { Parse } from '../ref/yaml';
import { Help } from "../../help";
import { PipelinePlugin } from "./pipeline";
export function GetPlugin_HelpAutoRest(): PipelinePlugin {
export function GetPlugin_Help(): PipelinePlugin {
return async config => {
config.GeneratedFile.Dispatch({
type: "help",
uri: "_help-autorest.0.json",
content: JSON.stringify(<Help>{
categoryFriendlyName: "Overall Verbosity",
settings: [
// {
// key: "quiet",
// description: "suppress most output information"
// },
{
key: "verbose",
description: "display verbose logging information"
},
{
key: "debug",
description: "display debug logging information"
}
]
})
});
config.GeneratedFile.Dispatch({
type: "help",
uri: "_help-autorest.1.json",
content: JSON.stringify(<Help>{
categoryFriendlyName: "Manage Installation",
settings: [
{
key: "info", // list-installed
description: "display information about the installed version of autorest and its extensions"
},
{
key: "list-available",
description: "display available AutoRest versions"
},
{
key: "reset",
description: "removes all autorest extensions and downloads the latest version of the autorest-core extension"
},
{
key: "preview",
description: "enables using autorest extensions that are not yet released"
},
{
key: "latest",
description: "installs the latest autorest-core extension"
},
{
key: "force",
description: "force the re-installation of the autorest-core extension and frameworks"
},
{
key: "version",
description: "use the specified version of the autorest-core extension",
type: "string"
}
]
})
});
const help: { [helpKey: string]: Help } = config.GetEntry("help-content" as any);
for (const helpKey of Object.keys(help).sort()) {
config.GeneratedFile.Dispatch({
type: "help",
uri: `${helpKey}.json`,
content: JSON.stringify(help[helpKey])
});
}
return new QuickDataSource([]);
};
}
export function GetPlugin_HelpAutoRestCore(): PipelinePlugin {
return async config => {
config.GeneratedFile.Dispatch({
type: "help",
uri: "_help-autorestCore.0.json",
content: JSON.stringify(<Help>{
categoryFriendlyName: "Core Settings and Switches",
settings: [
{
key: "help",
description: "display help (combine with flags like --csharp to get further details about specific functionality)"
},
{
key: "input-file",
type: "string | string[]",
description: "OpenAPI file to use as input (use this setting repeatedly to pass multiple files at once)"
},
{
key: "output-folder",
type: "string",
description: "target folder for generated artifacts; default: \"<base folder>/generated\""
},
{
key: "base-folder",
description: "path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise"
},
{
key: "message-format",
type: "\"regular\" | \"json\"",
description: "format of messages (e.g. from OpenAPI validation); default: \"regular\""
},
]
})
});
config.GeneratedFile.Dispatch({
type: "help",
uri: "_help-autorestCore.1.json",
content: JSON.stringify(<Help>{
categoryFriendlyName: "Core Functionality",
description: "> While AutoRest can be extended arbitrarily by 3rd parties (say, with a custom generator),\n> we officially support and maintain the following functionality.\n> More specific help is shown when combining the following switches with `--help` .",
settings: [
{
key: "csharp",
description: "generate C# client code"
},
{
key: "go",
description: "generate Go client code"
},
{
key: "java",
description: "generate Java client code"
},
{
key: "python",
description: "generate Python client code"
},
{
key: "nodejs",
description: "generate NodeJS client code"
},
{
key: "typescript",
description: "generate TypeScript client code"
},
{
key: "ruby",
description: "generate Ruby client code"
},
{
key: "php",
description: "generate PHP client code"
},
{
key: "azureresourceschema",
description: "generate Azure resource schemas"
},
{
key: "model-validator",
description: "validates an OpenAPI document against linked examples (see https://github.com/Azure/azure-rest-api-specs/search?q=x-ms-examples )"
},
// {
// key: "semantic-validator",
// description: "validates semantic validation"
// },
{
key: "azure-validator",
description: "validates an OpenAPI document against guidelines to improve quality (and optionally Azure guidelines)"
},
]
})
});
return new QuickDataSource([]);
};
}
}

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

@ -21,7 +21,7 @@ import { EmitArtifacts } from "./artifact-emitter";
import { ComposeSwaggers, LoadLiterateSwaggerOverrides, LoadLiterateSwaggers } from './swagger-loader';
import { ConvertOAI2toOAI3 } from "../openapi/conversion";
import { Help } from '../../help';
import { GetPlugin_HelpAutoRest, GetPlugin_HelpAutoRestCore } from "./help";
import { GetPlugin_Help } from "./help";
export type PipelinePlugin = (config: ConfigurationView, input: DataSource, sink: DataSink) => Promise<DataSource>;
interface PipelineNode {
@ -292,8 +292,7 @@ function BuildPipeline(config: ConfigurationView): { pipeline: { [name: string]:
export async function RunPipeline(configView: ConfigurationView, fileSystem: IFileSystem): Promise<void> {
// built-in plugins
const plugins: { [name: string]: PipelinePlugin } = {
"help-autorest": GetPlugin_HelpAutoRest(),
"help-autorest-core": GetPlugin_HelpAutoRestCore(),
"help": GetPlugin_Help(),
"identity": GetPlugin_Identity(),
"loader": GetPlugin_Loader(),
"md-override-loader": GetPlugin_MdOverrideLoader(),

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

@ -111,18 +111,87 @@ scope-configuration-emitter:
``` yaml $(help)
input-file: dummy # trick "no input file" checks... may wanna refactor at some point
```
``` yaml
pipeline:
help/help-autorest:
scope: help
help/help-autorest-core:
help:
scope: help
output-artifact:
- null # so emitted help doesn't necessarily have to say its output-artifact
- help
help-content: # type: Help as defined in autorest-core/help.ts
_autorest-0:
categoryFriendlyName: Overall Verbosity
settings:
# - key: quiet
# description: suppress most output information
- key: verbose
description: display verbose logging information
- key: debug
description: display debug logging information
_autorest-1:
categoryFriendlyName: Manage Installation
settings:
- key: info # list-installed
description: display information about the installed version of autorest and its extensions
- key: list-available
description: display available AutoRest versions
- key: reset
description: removes all autorest extensions and downloads the latest version of the autorest-core extension
- key: preview
description: enables using autorest extensions that are not yet released
- key: latest
description: installs the latest autorest-core extension
- key: force
description: force the re-installation of the autorest-core extension and frameworks
- key: version
description: use the specified version of the autorest-core extension
type: string
_autorest-core-0:
categoryFriendlyName: Core Settings and Switches
settings:
- key: help
description: display help (combine with flags like --csharp to get further details about specific functionality)
- key: input-file
type: string | string[]
description: OpenAPI file to use as input (use this setting repeatedly to pass multiple files at once)
- key: output-folder
type: string
description: "target folder for generated artifacts; default: \"<base folder>/generated\""
- key: base-folder
type: string
description: "path to resolve relative paths (input/output files/folders) against; default: directory of configuration file, current directory otherwise"
- key: message-format
type: "\"regular\" | \"json\""
description: "format of messages (e.g. from OpenAPI validation); default: \"regular\""
_autorest-core-1:
categoryFriendlyName: Core Functionality
description: "> While AutoRest can be extended arbitrarily by 3rd parties (say, with a custom generator),\n> we officially support and maintain the following functionality.\n> More specific help is shown when combining the following switches with `--help` ."
settings:
- key: csharp
description: generate C# client code
- key: go
description: generate Go client code
- key: java
description: generate Java client code
- key: python
description: generate Python client code
- key: nodejs
description: generate NodeJS client code
- key: typescript
description: generate TypeScript client code
- key: ruby
description: generate Ruby client code
- key: php
description: generate PHP client code
- key: azureresourceschema
description: generate Azure resource schemas
- key: model-validator
description: validates an OpenAPI document against linked examples (see https://github.com/Azure/azure-rest-api-specs/search?q=x-ms-examples )
# - key: semantic-validator
# description: validates an OpenAPI document semantically
- key: azure-validator
description: validates an OpenAPI document against guidelines to improve quality (and optionally Azure guidelines)
```
Note: We don't load anything if `--help` is specified.