зеркало из https://github.com/Azure/autorest.git
Swagger modeling things (#2683)
* config * OAI pipeline * normalize object outputs * load x-ms-odata stuff correctly * conversion fix * regen * ignore node process ID
This commit is contained in:
Родитель
7e7161cf2f
Коммит
0cc6fdc4b4
|
@ -30,6 +30,7 @@ task 'regenerate', 'regenerate samples', (done) ->
|
|||
(find path.join(each.path, ".."))
|
||||
.filter((file) -> file.match(/\.(map|txt)$/))
|
||||
.forEach((file) ->
|
||||
sed "-i", /\(node:\d+\)/g, "(node)", file # node process IDs
|
||||
sed "-i", /\bfile:\/\/[^\s]*\/autorest[^\/\\]*/g, "", file # blame locations
|
||||
sed "-i", /\sat .*/g, "at ...", file # exception stack traces
|
||||
sed "-i", /mem:\/\/\/[^: ]*/g, "mem", file # memory URIs (depend on timing)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,50 +1,194 @@
|
|||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "2015-02-28",
|
||||
"title": "Search Management",
|
||||
"description": "> the above JSON query pushes this markdown section into node `$.info.description` of the OpenAPI definition.\n\nThis client that can be used to manage Azure Search services and API keys."
|
||||
},
|
||||
"host": "management.azure.com",
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"azure_auth": [
|
||||
"user_impersonation"
|
||||
]
|
||||
}
|
||||
],
|
||||
"securityDefinitions": {
|
||||
"azure_auth": {
|
||||
"type": "oauth2",
|
||||
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
|
||||
"flow": "implicit",
|
||||
"description": "Azure Active Directory OAuth2 Flow",
|
||||
"scopes": {
|
||||
"user_impersonation": "impersonate your user account"
|
||||
"definitions": {
|
||||
"Error": {
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"details": {
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorDetails"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ErrorDetails": {
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ListQueryKeysResult": {
|
||||
"description": "Response containing the query API keys for a given Azure Search service.",
|
||||
"properties": {
|
||||
"value": {
|
||||
"description": "> Again, shorthand for `@.properties.value`\n\nThe query keys for the Azure Search service.",
|
||||
"items": {
|
||||
"$ref": "#/definitions/QueryKey"
|
||||
},
|
||||
"readOnly": true,
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"QueryKey": {
|
||||
"description": "Describes an API key for a given Azure Search service that has permissions for query operations only.",
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "The value of the query API key.",
|
||||
"readOnly": true,
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the query API key; may be empty.",
|
||||
"readOnly": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SearchServiceCreateOrUpdateParameters": {
|
||||
"description": "Properties that describe an Azure Search service.",
|
||||
"properties": {
|
||||
"location": {
|
||||
"description": "The geographic location of the Search service.",
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"$ref": "#/definitions/SearchServiceProperties",
|
||||
"description": "Properties of the Search service."
|
||||
},
|
||||
"tags": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Tags to help categorize the Search service in the Azure Portal.",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SearchServiceListResult": {
|
||||
"description": "> Shorthand for `@.definitions.SearchServiceListResult` which equals `$.definitions.SearchServiceListResult` since no super headings change the current scope.\n\nResponse containing a list of Azure Search services for a given resource group.",
|
||||
"properties": {
|
||||
"value": {
|
||||
"description": "The Search services in the resource group.",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SearchServiceResource"
|
||||
},
|
||||
"readOnly": true,
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SearchServiceProperties": {
|
||||
"description": "Defines properties of an Azure Search service that can be modified.",
|
||||
"properties": {
|
||||
"partitionCount": {
|
||||
"description": "The number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12.",
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
},
|
||||
"replicaCount": {
|
||||
"description": "The number of replicas in the Search service.",
|
||||
"format": "int32",
|
||||
"maximum": 6,
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SearchServiceResource": {
|
||||
"description": "Describes an Azure Search service and its current state.",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The resource Id of the Azure Search service.",
|
||||
"readOnly": true,
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"description": "The geographic location of the Search service.",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the Search service.",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn857353.aspx"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Tags to help categorize the Search service in the Azure Portal.",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"host": "management.azure.com",
|
||||
"info": {
|
||||
"description": "> the above JSON query pushes this markdown section into node `$.info.description` of the OpenAPI definition.\n\nThis client that can be used to manage Azure Search services and API keys.",
|
||||
"title": "Search Management",
|
||||
"version": "2015-02-28"
|
||||
},
|
||||
"parameters": {
|
||||
"ApiVersion": {
|
||||
"description": "The client API version.",
|
||||
"in": "query",
|
||||
"name": "api-version",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"ResourceGroupName": {
|
||||
"description": "The name of the resource group within the current subscription.",
|
||||
"in": "path",
|
||||
"name": "resourceGroupName",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-parameter-location": "method"
|
||||
},
|
||||
"SearchServiceName": {
|
||||
"description": "The name of the Search service to operate on.",
|
||||
"in": "path",
|
||||
"name": "serviceName",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-parameter-location": "method"
|
||||
},
|
||||
"SubscriptionId": {
|
||||
"description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription.\nThe subscription ID forms part of the URI for every service call.",
|
||||
"in": "path",
|
||||
"name": "subscriptionId",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"paths": {
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listQueryKeys": {
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"QueryKeys"
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "QueryKeys_List",
|
||||
"description": "Returns a list of all Search services in the given resource group.",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832701.aspx"
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832688.aspx"
|
||||
},
|
||||
"operationId": "Services_List",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/ResourceGroupName"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SearchServiceName",
|
||||
"description": "> Search is also performed relative to nodes discovered by parent headings.\n>\n> In this case, we're in the scope of the node identified by `#QueryKeys_List` which is the operation.\n>\n> Furthermore, `#SearchServiceName` is really shorthand for `@.#SearchServiceName` where `@` represents the current scope's node.\n> One could force searching the global scope with `$.#SearchServiceName`\n\nSome description."
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/ApiVersion"
|
||||
},
|
||||
|
@ -52,35 +196,35 @@
|
|||
"$ref": "#/parameters/SubscriptionId"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ListQueryKeysResult"
|
||||
"$ref": "#/definitions/SearchServiceListResult"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
},
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "> `#QueryKeys_List` searches for an object that has a string property containing \"QueryKeys_List\".\n\nReturns the list of query API keys for the given Azure Search service."
|
||||
"tags": [
|
||||
"Services"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Services"
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "Services_CreateOrUpdate",
|
||||
"description": "Deletes a Search service in the given resource group, along with its associated resources.",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832687.aspx"
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832692.aspx"
|
||||
},
|
||||
"operationId": "Services_Delete",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/ResourceGroupName"
|
||||
|
@ -89,13 +233,57 @@
|
|||
"$ref": "#/parameters/SearchServiceName"
|
||||
},
|
||||
{
|
||||
"name": "parameters",
|
||||
"$ref": "#/parameters/ApiVersion"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SubscriptionId"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found"
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Services"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Creates or updates a Search service in the given resource group.\nIf the Search service already exists, all properties will be updated with the given values.",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832687.aspx"
|
||||
},
|
||||
"operationId": "Services_CreateOrUpdate",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/ResourceGroupName"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SearchServiceName"
|
||||
},
|
||||
{
|
||||
"description": "The properties to set or update on the Search service.",
|
||||
"in": "body",
|
||||
"name": "parameters",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/SearchServiceCreateOrUpdateParameters"
|
||||
},
|
||||
"description": "The properties to set or update on the Search service."
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/ApiVersion"
|
||||
|
@ -104,6 +292,9 @@
|
|||
"$ref": "#/parameters/SubscriptionId"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
@ -121,72 +312,29 @@
|
|||
"$ref": "#/responses/error"
|
||||
}
|
||||
},
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Creates or updates a Search service in the given resource group.\nIf the Search service already exists, all properties will be updated with the given values."
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Services"
|
||||
],
|
||||
"operationId": "Services_Delete",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832692.aspx"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/ResourceGroupName"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SearchServiceName"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/ApiVersion"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SubscriptionId"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found"
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
},
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Deletes a Search service in the given resource group, along with its associated resources."
|
||||
]
|
||||
}
|
||||
},
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices": {
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listQueryKeys": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Services"
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "Services_List",
|
||||
"description": "> `#QueryKeys_List` searches for an object that has a string property containing \"QueryKeys_List\".\n\nReturns the list of query API keys for the given Azure Search service.",
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832688.aspx"
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn832701.aspx"
|
||||
},
|
||||
"operationId": "QueryKeys_List",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/ResourceGroupName"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/SearchServiceName",
|
||||
"description": "> Search is also performed relative to nodes discovered by parent headings.\n>\n> In this case, we're in the scope of the node identified by `#QueryKeys_List` which is the operation.\n>\n> Furthermore, `#SearchServiceName` is really shorthand for `@.#SearchServiceName` where `@` represents the current scope's node.\n> One could force searching the global scope with `$.#SearchServiceName`\n\nSome description."
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/ApiVersion"
|
||||
},
|
||||
|
@ -194,196 +342,26 @@
|
|||
"$ref": "#/parameters/SubscriptionId"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/SearchServiceListResult"
|
||||
"$ref": "#/definitions/ListQueryKeysResult"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
},
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Returns a list of all Search services in the given resource group."
|
||||
"tags": [
|
||||
"QueryKeys"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"ListQueryKeysResult": {
|
||||
"properties": {
|
||||
"value": {
|
||||
"readOnly": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/QueryKey"
|
||||
},
|
||||
"description": "> Again, shorthand for `@.properties.value`\n\nThe query keys for the Azure Search service."
|
||||
}
|
||||
},
|
||||
"description": "Response containing the query API keys for a given Azure Search service."
|
||||
},
|
||||
"QueryKey": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"readOnly": true,
|
||||
"type": "string",
|
||||
"description": "The name of the query API key; may be empty."
|
||||
},
|
||||
"key": {
|
||||
"readOnly": true,
|
||||
"type": "string",
|
||||
"description": "The value of the query API key."
|
||||
}
|
||||
},
|
||||
"description": "Describes an API key for a given Azure Search service that has permissions for query operations only."
|
||||
},
|
||||
"SearchServiceProperties": {
|
||||
"properties": {
|
||||
"replicaCount": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"description": "The number of replicas in the Search service."
|
||||
},
|
||||
"partitionCount": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "The number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12."
|
||||
}
|
||||
},
|
||||
"description": "Defines properties of an Azure Search service that can be modified."
|
||||
},
|
||||
"SearchServiceCreateOrUpdateParameters": {
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The geographic location of the Search service."
|
||||
},
|
||||
"tags": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Tags to help categorize the Search service in the Azure Portal."
|
||||
},
|
||||
"properties": {
|
||||
"$ref": "#/definitions/SearchServiceProperties",
|
||||
"description": "Properties of the Search service."
|
||||
}
|
||||
},
|
||||
"description": "Properties that describe an Azure Search service."
|
||||
},
|
||||
"SearchServiceResource": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"readOnly": true,
|
||||
"type": "string",
|
||||
"description": "The resource Id of the Azure Search service."
|
||||
},
|
||||
"name": {
|
||||
"externalDocs": {
|
||||
"url": "https://msdn.microsoft.com/library/azure/dn857353.aspx"
|
||||
},
|
||||
"type": "string",
|
||||
"description": "The name of the Search service."
|
||||
},
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The geographic location of the Search service."
|
||||
},
|
||||
"tags": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Tags to help categorize the Search service in the Azure Portal."
|
||||
}
|
||||
},
|
||||
"description": "Describes an Azure Search service and its current state."
|
||||
},
|
||||
"SearchServiceListResult": {
|
||||
"properties": {
|
||||
"value": {
|
||||
"readOnly": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SearchServiceResource"
|
||||
},
|
||||
"description": "The Search services in the resource group."
|
||||
}
|
||||
},
|
||||
"description": "> Shorthand for `@.definitions.SearchServiceListResult` which equals `$.definitions.SearchServiceListResult` since no super headings change the current scope.\n\nResponse containing a list of Azure Search services for a given resource group."
|
||||
},
|
||||
"Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorDetails": {
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": {
|
||||
"SubscriptionId": {
|
||||
"name": "subscriptionId",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription.\nThe subscription ID forms part of the URI for every service call."
|
||||
},
|
||||
"ApiVersion": {
|
||||
"name": "api-version",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "The client API version."
|
||||
},
|
||||
"ResourceGroupName": {
|
||||
"name": "resourceGroupName",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-parameter-location": "method",
|
||||
"description": "The name of the resource group within the current subscription."
|
||||
},
|
||||
"SearchServiceName": {
|
||||
"name": "serviceName",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-parameter-location": "method",
|
||||
"description": "The name of the Search service to operate on."
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"error": {
|
||||
"description": "OK",
|
||||
|
@ -391,5 +369,27 @@
|
|||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"azure_auth": [
|
||||
"user_impersonation"
|
||||
]
|
||||
}
|
||||
],
|
||||
"securityDefinitions": {
|
||||
"azure_auth": {
|
||||
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
|
||||
"description": "Azure Active Directory OAuth2 Flow",
|
||||
"flow": "implicit",
|
||||
"scopes": {
|
||||
"user_impersonation": "impersonate your user account"
|
||||
},
|
||||
"type": "oauth2"
|
||||
}
|
||||
},
|
||||
"swagger": "2.0"
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,241 +1,25 @@
|
|||
---
|
||||
directive:
|
||||
- from: storage.json
|
||||
where: >-
|
||||
$.paths["/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"].post.description
|
||||
set: >-
|
||||
Checks that the account name has sufficient cowbell (in order to prevent
|
||||
fevers).
|
||||
reason: We've experienced a lack of cowbell in storage account names.
|
||||
- from: storage.json
|
||||
where: >-
|
||||
$.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"].put.description
|
||||
transform: $ += " Make sure you add that extra cowbell."
|
||||
reason: Make sure people know.
|
||||
- from: storage.json
|
||||
where: $.definitions.Usage.description
|
||||
transform: return $.toUpperCase()
|
||||
reason: >-
|
||||
Our new guidelines require upper case descriptions here. Customers love
|
||||
it.
|
||||
- from: swagger-document
|
||||
where: $.paths..operationId
|
||||
transform: 'return $.replace(/ies$/, "y")'
|
||||
reason: I don't like plural.
|
||||
- from: code-model-v1
|
||||
where: '$.operations[*]'
|
||||
transform: >
|
||||
const url = $.methods[0]["url"]; const res =
|
||||
url.split("/Microsoft.Storage/")[1].split("/")[0]; $.name.raw = res;
|
||||
$.summary = JSON.stringify($, null, 2);
|
||||
reason: We wanna group methods by URI.
|
||||
- from: swagger-document
|
||||
where: $.definitions.*.additionalProperties
|
||||
transform: |
|
||||
return typeof $ === "boolean"
|
||||
? ($ ? { type: "object" } : undefined)
|
||||
: $
|
||||
reason: polyfill
|
||||
input-file:
|
||||
- >-
|
||||
https://github.com/Azure/azure-rest-api-specs/blob/d374d03801e97737ddb32e01f20513e7b2bbd9c3/arm-storage/2015-06-15/swagger/storage.json
|
||||
output-artifact:
|
||||
- swagger-document.json
|
||||
- code-model-v1.yaml
|
||||
- pipeline.yaml
|
||||
- configuration.yaml
|
||||
- source-file-csharp
|
||||
- source-file-jsonrpcclient
|
||||
require: []
|
||||
use: []
|
||||
clear-output-folder: {}
|
||||
use-extension:
|
||||
'@microsoft.azure/autorest.csharp': ~2.1.0
|
||||
'@microsoft.azure/classic-openapi-validator': ~1.0.3
|
||||
'@microsoft.azure/openapi-validator': ~1.0.0
|
||||
'@microsoft.azure/autorest.modeler': 2.1.22
|
||||
|
||||
no-upgrade-check: {}
|
||||
skip-upgrade-check: {}
|
||||
__info: yaml
|
||||
__status: {}
|
||||
azure-arm: true
|
||||
azure-validator: true
|
||||
azure-validator-composed:
|
||||
merge-state: composed
|
||||
azure-validator-individual:
|
||||
merge-state: individual
|
||||
base-folder: .
|
||||
clear-output-folder: {}
|
||||
client-side-validation: true
|
||||
csharp:
|
||||
output-folder: Client
|
||||
__info: yaml
|
||||
output-folder: generated
|
||||
openapi-type: arm
|
||||
pipeline:
|
||||
pipeline-emitter:
|
||||
scope: scope-pipeline-emitter
|
||||
suffixes:
|
||||
- ''
|
||||
configuration-emitter:
|
||||
scope: scope-configuration-emitter
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document-override/md-override-loader:
|
||||
output-artifact: immediate-config
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/loader:
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/transform:
|
||||
input: loader
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/identity:
|
||||
input: transform
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/compose:
|
||||
input: individual/identity
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/transform-immediate:
|
||||
input:
|
||||
- swagger-document-override/md-override-loader
|
||||
- compose
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/transform:
|
||||
input: transform-immediate
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/identity:
|
||||
input: transform
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/emitter:
|
||||
input: transform
|
||||
scope: scope-swagger-document/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/model-validator:
|
||||
input: swagger-document/identity
|
||||
scope: model-validator
|
||||
suffixes: []
|
||||
swagger-document/semantic-validator:
|
||||
input: swagger-document/identity
|
||||
scope: semantic-validator
|
||||
suffixes: []
|
||||
csharp/modeler:
|
||||
input: swagger-document/identity
|
||||
output-artifact: code-model-v1
|
||||
scope: csharp
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/commonmarker:
|
||||
input: modeler
|
||||
output-artifact: code-model-v1
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/cm/transform:
|
||||
input: commonmarker
|
||||
output-artifact: code-model-v1
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/cm/emitter:
|
||||
input: transform
|
||||
scope: scope-cm/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/generate:
|
||||
plugin: csharp
|
||||
input: cm/transform
|
||||
output-artifact: source-file-csharp
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/simplifier:
|
||||
plugin: csharp-simplifier
|
||||
input: generate
|
||||
output-artifact: source-file-csharp
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/transform:
|
||||
input: simplifier
|
||||
output-artifact: source-file-csharp
|
||||
scope: scope-transform-string
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/emitter:
|
||||
input: transform
|
||||
scope: scope-csharp/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
jsonrpcclient/modeler:
|
||||
input: swagger-document/identity
|
||||
output-artifact: code-model-v1
|
||||
scope: jsonrpcclient
|
||||
suffixes: []
|
||||
jsonrpcclient/generate:
|
||||
plugin: jsonrpcclient
|
||||
input: modeler
|
||||
output-artifact: source-file-jsonrpcclient
|
||||
suffixes: []
|
||||
jsonrpcclient/transform:
|
||||
input: generate
|
||||
output-artifact: source-file-jsonrpcclient
|
||||
scope: scope-transform-string
|
||||
suffixes: []
|
||||
jsonrpcclient/emitter:
|
||||
input: transform
|
||||
scope: scope-jsonrpcclient/emitter
|
||||
suffixes: []
|
||||
swagger-document/classic-openapi-validator:
|
||||
input: swagger-document/identity
|
||||
scope: azure-validator-composed
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/classic-openapi-validator:
|
||||
input: swagger-document/individual/identity
|
||||
scope: azure-validator-individual
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/openapi-validator:
|
||||
input: swagger-document/identity
|
||||
scope: azure-validator-composed
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/openapi-validator:
|
||||
input: swagger-document/individual/identity
|
||||
scope: azure-validator-individual
|
||||
suffixes:
|
||||
- ''
|
||||
scope-pipeline-emitter:
|
||||
input-artifact: pipeline
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"pipeline"
|
||||
scope-configuration-emitter:
|
||||
input-artifact: configuration
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"configuration"
|
||||
scope-swagger-document/emitter:
|
||||
input-artifact: swagger-document
|
||||
is-object: true
|
||||
output-uri-expr: >
|
||||
$config["output-file"] ||
|
||||
|
||||
($config.namespace ? $config.namespace.replace(/:/g,'_') : undefined) ||
|
||||
|
||||
$config["input-file"][0].split('/').reverse()[0].split('\\').reverse()[0].replace(/\.json$/,
|
||||
"")
|
||||
scope-cm/emitter:
|
||||
input-artifact: code-model-v1
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"code-model-v1"
|
||||
client-side-validation: true
|
||||
debug: false
|
||||
declare-directive:
|
||||
remove-operation: |-
|
||||
{
|
||||
from: 'swagger-document',
|
||||
"where-operation": $,
|
||||
transform: 'return undefined'
|
||||
}
|
||||
set: '{ transform: `return ${JSON.stringify($)}` }'
|
||||
where-operation: |-
|
||||
(() => {
|
||||
|
@ -247,26 +31,267 @@ declare-directive:
|
|||
return { from: "swagger-document", where: `$.paths.*[?(@.operationId == ${JSON.stringify($)})]` };
|
||||
}
|
||||
})()
|
||||
remove-operation: |-
|
||||
{
|
||||
from: 'swagger-document',
|
||||
"where-operation": $,
|
||||
transform: 'return undefined'
|
||||
}
|
||||
directive:
|
||||
- from: storage.json
|
||||
reason: We've experienced a lack of cowbell in storage account names.
|
||||
set: >-
|
||||
Checks that the account name has sufficient cowbell (in order to prevent
|
||||
fevers).
|
||||
where: >-
|
||||
$.paths["/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"].post.description
|
||||
- from: storage.json
|
||||
reason: Make sure people know.
|
||||
transform: $ += " Make sure you add that extra cowbell."
|
||||
where: >-
|
||||
$.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"].put.description
|
||||
- from: storage.json
|
||||
reason: >-
|
||||
Our new guidelines require upper case descriptions here. Customers love
|
||||
it.
|
||||
transform: return $.toUpperCase()
|
||||
where: $.definitions.Usage.description
|
||||
- from: swagger-document
|
||||
reason: I don't like plural.
|
||||
transform: 'return $.replace(/ies$/, "y")'
|
||||
where: $.paths..operationId
|
||||
- from: code-model-v1
|
||||
reason: We wanna group methods by URI.
|
||||
transform: >
|
||||
const url = $.methods[0]["url"]; const res =
|
||||
url.split("/Microsoft.Storage/")[1].split("/")[0]; $.name.raw = res;
|
||||
$.summary = JSON.stringify($, null, 2);
|
||||
where: '$.operations[*]'
|
||||
- from: swagger-document
|
||||
reason: polyfill
|
||||
transform: |
|
||||
return typeof $ === "boolean"
|
||||
? ($ ? { type: "object" } : undefined)
|
||||
: $
|
||||
where: $.definitions.*.additionalProperties
|
||||
disable-validation: false
|
||||
input-file:
|
||||
- >-
|
||||
https://github.com/Azure/azure-rest-api-specs/blob/d374d03801e97737ddb32e01f20513e7b2bbd9c3/arm-storage/2015-06-15/swagger/storage.json
|
||||
no-upgrade-check: {}
|
||||
openapi-type: arm
|
||||
output-artifact:
|
||||
- swagger-document.json
|
||||
- code-model-v1.yaml
|
||||
- pipeline.yaml
|
||||
- configuration.yaml
|
||||
- source-file-csharp
|
||||
- source-file-jsonrpcclient
|
||||
output-folder: generated
|
||||
pipeline:
|
||||
configuration-emitter:
|
||||
scope: scope-configuration-emitter
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/cm/emitter:
|
||||
input: transform
|
||||
scope: scope-cm/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/cm/transform:
|
||||
input: commonmarker
|
||||
output-artifact: code-model-v1
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/commonmarker:
|
||||
input: modeler
|
||||
output-artifact: code-model-v1
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/emitter:
|
||||
input: transform
|
||||
scope: scope-csharp/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/generate:
|
||||
input: cm/transform
|
||||
output-artifact: source-file-csharp
|
||||
plugin: csharp
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/modeler:
|
||||
input: swagger-document/identity
|
||||
output-artifact: code-model-v1
|
||||
scope: csharp
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/simplifier:
|
||||
input: generate
|
||||
output-artifact: source-file-csharp
|
||||
plugin: csharp-simplifier
|
||||
suffixes:
|
||||
- ''
|
||||
csharp/transform:
|
||||
input: simplifier
|
||||
output-artifact: source-file-csharp
|
||||
scope: scope-transform-string
|
||||
suffixes:
|
||||
- ''
|
||||
jsonrpcclient/emitter:
|
||||
input: transform
|
||||
scope: scope-jsonrpcclient/emitter
|
||||
suffixes: []
|
||||
jsonrpcclient/generate:
|
||||
input: modeler
|
||||
output-artifact: source-file-jsonrpcclient
|
||||
plugin: jsonrpcclient
|
||||
suffixes: []
|
||||
jsonrpcclient/modeler:
|
||||
input: swagger-document/identity
|
||||
output-artifact: code-model-v1
|
||||
scope: jsonrpcclient
|
||||
suffixes: []
|
||||
jsonrpcclient/transform:
|
||||
input: generate
|
||||
output-artifact: source-file-jsonrpcclient
|
||||
scope: scope-transform-string
|
||||
suffixes: []
|
||||
openapi-document/emitter:
|
||||
input: identity
|
||||
scope: scope-openapi-document/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
openapi-document/identity:
|
||||
input: openapi-document-converter
|
||||
output-artifact: openapi-document
|
||||
suffixes:
|
||||
- ''
|
||||
openapi-document/openapi-document-converter:
|
||||
input: swagger-document/identity
|
||||
output-artifact: openapi-document
|
||||
suffixes:
|
||||
- ''
|
||||
pipeline-emitter:
|
||||
scope: scope-pipeline-emitter
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document-override/md-override-loader:
|
||||
output-artifact: immediate-config
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/classic-openapi-validator:
|
||||
input: swagger-document/identity
|
||||
scope: azure-validator-composed
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/compose:
|
||||
input: individual/identity
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/emitter:
|
||||
input: identity
|
||||
scope: scope-swagger-document/emitter
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/identity:
|
||||
input: transform
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/classic-openapi-validator:
|
||||
input: swagger-document/individual/identity
|
||||
scope: azure-validator-individual
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/identity:
|
||||
input: transform
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/openapi-validator:
|
||||
input: swagger-document/individual/identity
|
||||
scope: azure-validator-individual
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/individual/transform:
|
||||
input: loader
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/loader:
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/model-validator:
|
||||
input: swagger-document/identity
|
||||
scope: model-validator
|
||||
suffixes: []
|
||||
swagger-document/openapi-validator:
|
||||
input: swagger-document/identity
|
||||
scope: azure-validator-composed
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/semantic-validator:
|
||||
input: swagger-document/identity
|
||||
scope: semantic-validator
|
||||
suffixes: []
|
||||
swagger-document/transform:
|
||||
input: transform-immediate
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
swagger-document/transform-immediate:
|
||||
input:
|
||||
- swagger-document-override/md-override-loader
|
||||
- compose
|
||||
output-artifact: swagger-document
|
||||
suffixes:
|
||||
- ''
|
||||
require: []
|
||||
scope-cm/emitter:
|
||||
input-artifact: code-model-v1
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"code-model-v1"
|
||||
scope-configuration-emitter:
|
||||
input-artifact: configuration
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"configuration"
|
||||
scope-csharp/emitter:
|
||||
input-artifact: source-file-csharp
|
||||
output-uri-expr: $key
|
||||
scope-jsonrpcclient/emitter:
|
||||
input-artifact: source-file-jsonrpcclient
|
||||
output-uri-expr: $key
|
||||
azure-validator-composed:
|
||||
merge-state: composed
|
||||
azure-validator-individual:
|
||||
merge-state: individual
|
||||
scope-openapi-document/emitter:
|
||||
input-artifact: openapi-document
|
||||
is-object: true
|
||||
output-uri-expr: >
|
||||
$config["output-file"] ||
|
||||
|
||||
($config.namespace ? $config.namespace.replace(/:/g,'_') : undefined) ||
|
||||
|
||||
$config["input-file"][0].split('/').reverse()[0].split('\\').reverse()[0].replace(/\.json$/,
|
||||
"")
|
||||
scope-pipeline-emitter:
|
||||
input-artifact: pipeline
|
||||
is-object: true
|
||||
output-uri-expr: |
|
||||
"pipeline"
|
||||
scope-swagger-document/emitter:
|
||||
input-artifact: swagger-document
|
||||
is-object: true
|
||||
output-uri-expr: >
|
||||
$config["output-file"] ||
|
||||
|
||||
($config.namespace ? $config.namespace.replace(/:/g,'_') : undefined) ||
|
||||
|
||||
$config["input-file"][0].split('/').reverse()[0].split('\\').reverse()[0].replace(/\.json$/,
|
||||
"")
|
||||
scope-transform-string:
|
||||
is-object: false
|
||||
base-folder: .
|
||||
debug: false
|
||||
skip-upgrade-check: {}
|
||||
use: []
|
||||
use-extension:
|
||||
'@microsoft.azure/autorest.csharp': ~2.1.0
|
||||
'@microsoft.azure/autorest.modeler': 2.1.22
|
||||
'@microsoft.azure/classic-openapi-validator': ~1.0.3
|
||||
'@microsoft.azure/openapi-validator': ~1.0.0
|
||||
verbose: false
|
||||
disable-validation: false
|
||||
__status: {}
|
||||
|
||||
|
|
|
@ -1,146 +1,164 @@
|
|||
---
|
||||
pipeline-emitter:
|
||||
pluginName: pipeline-emitter
|
||||
configScope:
|
||||
- scope-pipeline-emitter
|
||||
inputs: []
|
||||
configuration-emitter:
|
||||
pluginName: configuration-emitter
|
||||
configScope:
|
||||
- scope-configuration-emitter
|
||||
inputs: []
|
||||
swagger-document-override/md-override-loader:
|
||||
pluginName: md-override-loader
|
||||
outputArtifact: immediate-config
|
||||
configScope: []
|
||||
inputs: []
|
||||
swagger-document/loader:
|
||||
pluginName: loader
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs: []
|
||||
swagger-document/individual/transform:
|
||||
pluginName: transform
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/loader
|
||||
swagger-document/individual/identity:
|
||||
pluginName: identity
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/individual/transform
|
||||
swagger-document/compose:
|
||||
pluginName: compose
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/individual/identity
|
||||
swagger-document/transform-immediate:
|
||||
pluginName: transform-immediate
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document-override/md-override-loader
|
||||
- swagger-document/compose
|
||||
swagger-document/transform:
|
||||
pluginName: transform
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/transform-immediate
|
||||
swagger-document/identity:
|
||||
pluginName: identity
|
||||
outputArtifact: swagger-document
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/transform
|
||||
swagger-document/emitter:
|
||||
pluginName: emitter
|
||||
configScope:
|
||||
- scope-swagger-document/emitter
|
||||
inputs:
|
||||
- swagger-document/transform
|
||||
csharp/modeler:
|
||||
pluginName: modeler
|
||||
outputArtifact: code-model-v1
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
csharp/commonmarker:
|
||||
pluginName: commonmarker
|
||||
outputArtifact: code-model-v1
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/modeler
|
||||
csharp/cm/transform:
|
||||
pluginName: transform
|
||||
outputArtifact: code-model-v1
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/commonmarker
|
||||
pluginName: configuration-emitter
|
||||
csharp/cm/emitter:
|
||||
pluginName: emitter
|
||||
configScope:
|
||||
- csharp
|
||||
- scope-cm/emitter
|
||||
inputs:
|
||||
- csharp/cm/transform
|
||||
csharp/generate:
|
||||
pluginName: csharp
|
||||
outputArtifact: source-file-csharp
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/cm/transform
|
||||
csharp/simplifier:
|
||||
pluginName: csharp-simplifier
|
||||
outputArtifact: source-file-csharp
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/generate
|
||||
csharp/transform:
|
||||
pluginName: transform
|
||||
outputArtifact: source-file-csharp
|
||||
configScope:
|
||||
- csharp
|
||||
- scope-transform-string
|
||||
inputs:
|
||||
- csharp/simplifier
|
||||
csharp/emitter:
|
||||
pluginName: emitter
|
||||
csharp/cm/transform:
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/commonmarker
|
||||
outputArtifact: code-model-v1
|
||||
pluginName: transform
|
||||
csharp/commonmarker:
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/modeler
|
||||
outputArtifact: code-model-v1
|
||||
pluginName: commonmarker
|
||||
csharp/emitter:
|
||||
configScope:
|
||||
- csharp
|
||||
- scope-transform-string
|
||||
- scope-csharp/emitter
|
||||
inputs:
|
||||
- csharp/transform
|
||||
pluginName: emitter
|
||||
csharp/generate:
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/cm/transform
|
||||
outputArtifact: source-file-csharp
|
||||
pluginName: csharp
|
||||
csharp/modeler:
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
outputArtifact: code-model-v1
|
||||
pluginName: modeler
|
||||
csharp/simplifier:
|
||||
configScope:
|
||||
- csharp
|
||||
inputs:
|
||||
- csharp/generate
|
||||
outputArtifact: source-file-csharp
|
||||
pluginName: csharp-simplifier
|
||||
csharp/transform:
|
||||
configScope:
|
||||
- csharp
|
||||
- scope-transform-string
|
||||
inputs:
|
||||
- csharp/simplifier
|
||||
outputArtifact: source-file-csharp
|
||||
pluginName: transform
|
||||
openapi-document/emitter:
|
||||
configScope:
|
||||
- scope-openapi-document/emitter
|
||||
inputs:
|
||||
- openapi-document/identity
|
||||
pluginName: emitter
|
||||
openapi-document/identity:
|
||||
configScope: []
|
||||
inputs:
|
||||
- openapi-document/openapi-document-converter
|
||||
outputArtifact: openapi-document
|
||||
pluginName: identity
|
||||
openapi-document/openapi-document-converter:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
outputArtifact: openapi-document
|
||||
pluginName: openapi-document-converter
|
||||
pipeline-emitter:
|
||||
configScope:
|
||||
- scope-pipeline-emitter
|
||||
inputs: []
|
||||
pluginName: pipeline-emitter
|
||||
swagger-document-override/md-override-loader:
|
||||
configScope: []
|
||||
inputs: []
|
||||
outputArtifact: immediate-config
|
||||
pluginName: md-override-loader
|
||||
swagger-document/classic-openapi-validator:
|
||||
pluginName: classic-openapi-validator
|
||||
configScope:
|
||||
- azure-validator-composed
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
pluginName: classic-openapi-validator
|
||||
swagger-document/compose:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/individual/identity
|
||||
outputArtifact: swagger-document
|
||||
pluginName: compose
|
||||
swagger-document/emitter:
|
||||
configScope:
|
||||
- scope-swagger-document/emitter
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
pluginName: emitter
|
||||
swagger-document/identity:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/transform
|
||||
outputArtifact: swagger-document
|
||||
pluginName: identity
|
||||
swagger-document/individual/classic-openapi-validator:
|
||||
pluginName: classic-openapi-validator
|
||||
configScope:
|
||||
- azure-validator-individual
|
||||
inputs:
|
||||
- swagger-document/individual/identity
|
||||
swagger-document/openapi-validator:
|
||||
pluginName: classic-openapi-validator
|
||||
swagger-document/individual/identity:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/individual/transform
|
||||
outputArtifact: swagger-document
|
||||
pluginName: identity
|
||||
swagger-document/individual/openapi-validator:
|
||||
configScope:
|
||||
- azure-validator-individual
|
||||
inputs:
|
||||
- swagger-document/individual/identity
|
||||
pluginName: openapi-validator
|
||||
swagger-document/individual/transform:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/loader
|
||||
outputArtifact: swagger-document
|
||||
pluginName: transform
|
||||
swagger-document/loader:
|
||||
configScope: []
|
||||
inputs: []
|
||||
outputArtifact: swagger-document
|
||||
pluginName: loader
|
||||
swagger-document/openapi-validator:
|
||||
configScope:
|
||||
- azure-validator-composed
|
||||
inputs:
|
||||
- swagger-document/identity
|
||||
swagger-document/individual/openapi-validator:
|
||||
pluginName: openapi-validator
|
||||
configScope:
|
||||
- azure-validator-individual
|
||||
swagger-document/transform:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document/individual/identity
|
||||
- swagger-document/transform-immediate
|
||||
outputArtifact: swagger-document
|
||||
pluginName: transform
|
||||
swagger-document/transform-immediate:
|
||||
configScope: []
|
||||
inputs:
|
||||
- swagger-document-override/md-override-loader
|
||||
- swagger-document/compose
|
||||
outputArtifact: swagger-document
|
||||
pluginName: transform-immediate
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,8 +1,25 @@
|
|||
components: [Object] } } }
|
||||
info: [Object],
|
||||
paths: [Object],
|
||||
schemes: [Object],
|
||||
servers: [Object],
|
||||
{ openapi: '3.0.0',
|
||||
cache: {},
|
||||
externals: [],
|
||||
openapi:
|
||||
{ patch: true,
|
||||
at ...
|
||||
at ...
|
||||
at ...
|
||||
--- End of stack trace from previous location where exception was thrown ---
|
||||
Error: Plugin modeler reported failure.
|
||||
(node) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
|
||||
(node) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: Could not resolve reference #/definitions/Cowball
|
||||
(node) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: Could not resolve reference #/definitions/Cowball
|
||||
(node) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): Error: Could not resolve reference #/definitions/Cowball
|
||||
{ Error: Could not resolve reference #/definitions/Cowball
|
||||
FATAL: csharp/modeler - FAILED
|
||||
FATAL: Error: Could not resolve reference #/definitions/Cowball
|
||||
FATAL: Error: Plugin modeler reported failure.
|
||||
FATAL: openapi-document/openapi-document-converter - FAILED
|
||||
FATAL: System.ArgumentException: Reference path 'Cowball' does not exist in the definition section of the Swagger document.
|
||||
options:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(C) 2017 **Microsoft Corporation.**
|
||||
# AutoRest code generation utility [version: 2.0.0]
|
||||
https://aka.ms/autorest
|
||||
Process() Cancelled due to exception : Plugin modeler reported failure.
|
||||
Process() Cancelled due to exception : Could not resolve reference #/definitions/Cowball
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
apiVersion: 1.0.0
|
||||
baseUrl: 'https://localhost'
|
||||
documentation: This is a sample.
|
||||
modelTypes:
|
||||
- $id: '1'
|
||||
$type: CompositeType
|
||||
containsConstantProperties: false
|
||||
documentation: A cowbell.
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
properties:
|
||||
- $id: '2'
|
||||
isReadOnly: false
|
||||
realPath:
|
||||
- id
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
raw: '42'
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: false
|
||||
isConstant: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: id
|
||||
serializedName: id
|
||||
isReadOnly: false
|
||||
isRequired: false
|
||||
modelType:
|
||||
$id: '3'
|
||||
$type: PrimaryType
|
||||
|
@ -27,22 +29,22 @@ modelTypes:
|
|||
name:
|
||||
fixed: false
|
||||
raw: Long
|
||||
- $id: '4'
|
||||
isReadOnly: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: id
|
||||
realPath:
|
||||
- name
|
||||
- id
|
||||
serializedName: id
|
||||
- $id: '4'
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
raw: shiny
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: true
|
||||
isConstant: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: name
|
||||
serializedName: name
|
||||
isReadOnly: false
|
||||
isRequired: true
|
||||
modelType:
|
||||
$id: '5'
|
||||
$type: PrimaryType
|
||||
|
@ -50,62 +52,60 @@ modelTypes:
|
|||
name:
|
||||
fixed: false
|
||||
raw: String
|
||||
name:
|
||||
fixed: false
|
||||
raw: name
|
||||
realPath:
|
||||
- name
|
||||
serializedName: name
|
||||
serializedName: Cowbell
|
||||
documentation: A cowbell.
|
||||
containsConstantProperties: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
modelsName: Models
|
||||
name: CowbellFactory
|
||||
namespace: ''
|
||||
modelsName: Models
|
||||
apiVersion: 1.0.0
|
||||
baseUrl: 'https://localhost'
|
||||
documentation: This is a sample.
|
||||
operations:
|
||||
- methods:
|
||||
- parameters:
|
||||
- defaultResponse:
|
||||
isNullable: true
|
||||
deprecated: false
|
||||
description: A good description.
|
||||
group:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
hidden: false
|
||||
httpMethod: post
|
||||
isAbsoluteUrl: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: Add
|
||||
parameters:
|
||||
- $id: '6'
|
||||
location: body
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: true
|
||||
isConstant: false
|
||||
isRequired: true
|
||||
location: body
|
||||
modelType:
|
||||
$ref: '1'
|
||||
name:
|
||||
fixed: false
|
||||
raw: body
|
||||
serializedName: body
|
||||
modelType:
|
||||
$ref: '1'
|
||||
name:
|
||||
fixed: false
|
||||
raw: Add
|
||||
group:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
serializedName: Cowbell_Add
|
||||
url: /cowbell
|
||||
isAbsoluteUrl: false
|
||||
httpMethod: post
|
||||
responses:
|
||||
OK:
|
||||
isNullable: true
|
||||
defaultResponse:
|
||||
isNullable: true
|
||||
returnType:
|
||||
isNullable: true
|
||||
description: A good description.
|
||||
requestContentType: application/json; charset=utf-8
|
||||
responseContentTypes:
|
||||
- application/json
|
||||
deprecated: false
|
||||
hidden: false
|
||||
responses:
|
||||
OK:
|
||||
isNullable: true
|
||||
returnType:
|
||||
isNullable: true
|
||||
serializedName: Cowbell_Add
|
||||
url: /cowbell
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
nameForProperty: Cowbell
|
||||
typeName:
|
||||
fixed: false
|
||||
nameForProperty: Cowbell
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
apiVersion: 1.0.0
|
||||
baseUrl: 'https://localhost'
|
||||
documentation: This is a sample.
|
||||
modelTypes:
|
||||
- $id: '1'
|
||||
$type: CompositeType
|
||||
containsConstantProperties: false
|
||||
documentation: A cowbell.
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
properties:
|
||||
- $id: '2'
|
||||
isReadOnly: false
|
||||
realPath:
|
||||
- id
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
raw: '42'
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: false
|
||||
isConstant: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: id
|
||||
serializedName: id
|
||||
isReadOnly: false
|
||||
isRequired: false
|
||||
modelType:
|
||||
$id: '3'
|
||||
$type: PrimaryType
|
||||
|
@ -27,22 +29,22 @@ modelTypes:
|
|||
name:
|
||||
fixed: false
|
||||
raw: Long
|
||||
- $id: '4'
|
||||
isReadOnly: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: id
|
||||
realPath:
|
||||
- name
|
||||
- id
|
||||
serializedName: id
|
||||
- $id: '4'
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
raw: shiny
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: true
|
||||
isConstant: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: name
|
||||
serializedName: name
|
||||
isReadOnly: false
|
||||
isRequired: true
|
||||
modelType:
|
||||
$id: '5'
|
||||
$type: PrimaryType
|
||||
|
@ -50,62 +52,60 @@ modelTypes:
|
|||
name:
|
||||
fixed: false
|
||||
raw: String
|
||||
name:
|
||||
fixed: false
|
||||
raw: name
|
||||
realPath:
|
||||
- name
|
||||
serializedName: name
|
||||
serializedName: Cowbell
|
||||
documentation: A cowbell.
|
||||
containsConstantProperties: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
modelsName: Models
|
||||
name: CowbellFactory
|
||||
namespace: ''
|
||||
modelsName: Models
|
||||
apiVersion: 1.0.0
|
||||
baseUrl: 'https://localhost'
|
||||
documentation: This is a sample.
|
||||
operations:
|
||||
- methods:
|
||||
- parameters:
|
||||
- defaultResponse:
|
||||
isNullable: true
|
||||
deprecated: false
|
||||
description: A good description.
|
||||
group:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
hidden: true
|
||||
httpMethod: post
|
||||
isAbsoluteUrl: false
|
||||
name:
|
||||
fixed: false
|
||||
raw: Add
|
||||
parameters:
|
||||
- $id: '6'
|
||||
location: body
|
||||
collectionFormat: none
|
||||
defaultValue:
|
||||
fixed: false
|
||||
documentation:
|
||||
fixed: false
|
||||
isRequired: true
|
||||
isConstant: false
|
||||
isRequired: true
|
||||
location: body
|
||||
modelType:
|
||||
$ref: '1'
|
||||
name:
|
||||
fixed: false
|
||||
raw: body
|
||||
serializedName: body
|
||||
modelType:
|
||||
$ref: '1'
|
||||
name:
|
||||
fixed: false
|
||||
raw: Add
|
||||
group:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
serializedName: Cowbell_Add
|
||||
url: /cowbell
|
||||
isAbsoluteUrl: false
|
||||
httpMethod: post
|
||||
responses:
|
||||
OK:
|
||||
isNullable: true
|
||||
defaultResponse:
|
||||
isNullable: true
|
||||
returnType:
|
||||
isNullable: true
|
||||
description: A good description.
|
||||
requestContentType: application/json; charset=utf-8
|
||||
responseContentTypes:
|
||||
- application/json
|
||||
deprecated: false
|
||||
hidden: true
|
||||
responses:
|
||||
OK:
|
||||
isNullable: true
|
||||
returnType:
|
||||
isNullable: true
|
||||
serializedName: Cowbell_Add
|
||||
url: /cowbell
|
||||
name:
|
||||
fixed: false
|
||||
raw: Cowbell
|
||||
nameForProperty: Cowbell
|
||||
typeName:
|
||||
fixed: false
|
||||
nameForProperty: Cowbell
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
---
|
||||
swagger: '2.0'
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Cowbell Factory
|
||||
description: This is a sample.
|
||||
definitions:
|
||||
Cowbell:
|
||||
description: A cowbell.
|
||||
properties:
|
||||
id:
|
||||
default: 42
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
default: shiny
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
host: localhost
|
||||
schemes:
|
||||
- https
|
||||
info:
|
||||
description: This is a sample.
|
||||
title: Cowbell Factory
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/cowbell:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
operationId: Cowbell_Get
|
||||
parameters:
|
||||
- in: query
|
||||
name: id
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
'200':
|
||||
schema:
|
||||
$ref: '#/definitions/Cowbell'
|
||||
produces:
|
||||
- application/json
|
||||
consumes:
|
||||
- application/json
|
||||
definitions:
|
||||
Cowbell:
|
||||
required:
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
default: 42
|
||||
name:
|
||||
type: string
|
||||
default: shiny
|
||||
description: A cowbell.
|
||||
schemes:
|
||||
- https
|
||||
swagger: '2.0'
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { DataHandle, DataSink } from '../data-store/data-store';
|
||||
const convertOAI2toOAI3 = async (oa2def: OpenApi2Definition): Promise<OpenApi3Definition> => (await require("swagger2openapi").convert(oa2def, { patch: true })).openapi;
|
||||
|
||||
export async function ConvertOAI2toOAI3(input: DataHandle, sink: DataSink): Promise<DataHandle> {
|
||||
const oa2 = input.ReadObject<OpenApi2Definition>();
|
||||
const oa3 = await convertOAI2toOAI3(oa2);
|
||||
return await sink.WriteObject("OpenAPI", oa3);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
interface OpenApi2Definition {
|
||||
|
||||
}
|
||||
|
||||
interface OpenApi3Definition {
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Lazy } from "../lazy";
|
||||
import { Stringify, YAMLNode } from "../ref/yaml";
|
||||
import { Stringify, YAMLNode, Normalize } from "../ref/yaml";
|
||||
import { IdentitySourceMapping } from "../source-map/merging";
|
||||
import { Channel } from "../message";
|
||||
import { ConfigurationView } from "../configuration";
|
||||
|
@ -44,11 +44,11 @@ async function EmitArtifact(config: ConfigurationView, artifactType: string, uri
|
|||
const ast = new Lazy<YAMLNode>(() => handle.ReadYamlAst());
|
||||
|
||||
if (IsOutputArtifactOrMapRequested(config, artifactType + ".yaml")) {
|
||||
const h = await sink.WriteData(`${++emitCtr}.yaml`, Stringify(object.Value), IdentitySourceMapping(handle.key, ast.Value), [handle]);
|
||||
const h = await sink.WriteData(`${++emitCtr}.yaml`, Stringify(Normalize(object.Value)), IdentitySourceMapping(handle.key, ast.Value), [handle]);
|
||||
await EmitArtifactInternal(config, artifactType + ".yaml", uri + ".yaml", h);
|
||||
}
|
||||
if (IsOutputArtifactOrMapRequested(config, artifactType + ".json")) {
|
||||
const h = await sink.WriteData(`${++emitCtr}.json`, JSON.stringify(object.Value, null, 2), IdentitySourceMapping(handle.key, ast.Value), [handle]);
|
||||
const h = await sink.WriteData(`${++emitCtr}.json`, JSON.stringify(Normalize(object.Value), null, 2), IdentitySourceMapping(handle.key, ast.Value), [handle]);
|
||||
await EmitArtifactInternal(config, artifactType + ".json", uri + ".json", h);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import { DataHandle, DataSink, DataSource, QuickDataSource } from '../data-store
|
|||
import { IFileSystem } from "../file-system";
|
||||
import { EmitArtifacts } from "./artifact-emitter";
|
||||
import { ComposeSwaggers, LoadLiterateSwaggerOverrides, LoadLiterateSwaggers } from './swagger-loader';
|
||||
import { ConvertOAI2toOAI3 } from "../openapi/conversion";
|
||||
|
||||
export type PipelinePlugin = (config: ConfigurationView, input: DataSource, sink: DataSink) => Promise<DataSource>;
|
||||
interface PipelineNode {
|
||||
|
@ -59,20 +60,37 @@ function CreatePluginMdOverrideLoader(): PipelinePlugin {
|
|||
};
|
||||
}
|
||||
|
||||
function CreatePluginTransformer(): PipelinePlugin {
|
||||
|
||||
function CreatePerFilePlugin(processorBuilder: (config: ConfigurationView) => Promise<(input: DataHandle, sink: DataSink) => Promise<DataHandle>>): PipelinePlugin {
|
||||
return async (config, input, sink) => {
|
||||
const isObject = config.GetEntry("is-object" as any) === false ? false : true;
|
||||
const manipulator = new Manipulator(config);
|
||||
const processor = await processorBuilder(config);
|
||||
const files = await input.Enum();
|
||||
const result: DataHandle[] = [];
|
||||
for (let file of files) {
|
||||
const fileIn = await input.ReadStrict(file);
|
||||
const fileOut = await manipulator.Process(fileIn, sink, isObject, fileIn.Description);
|
||||
result.push(await sink.Forward(fileIn.Description, fileOut));
|
||||
const fileOut = await processor(fileIn, sink);
|
||||
result.push(fileOut);
|
||||
}
|
||||
return new QuickDataSource(result);
|
||||
};
|
||||
}
|
||||
function CreatePluginOAI2toOAIx(): PipelinePlugin {
|
||||
return CreatePerFilePlugin(async config => async (fileIn, sink) => {
|
||||
const fileOut = await ConvertOAI2toOAI3(fileIn, sink);
|
||||
return await sink.Forward(fileIn.Description, fileOut);
|
||||
});
|
||||
}
|
||||
|
||||
function CreatePluginTransformer(): PipelinePlugin {
|
||||
return CreatePerFilePlugin(async config => {
|
||||
const isObject = config.GetEntry("is-object" as any) === false ? false : true;
|
||||
const manipulator = new Manipulator(config);
|
||||
return async (fileIn, sink) => {
|
||||
const fileOut = await manipulator.Process(fileIn, sink, isObject, fileIn.Description);
|
||||
return await sink.Forward(fileIn.Description, fileOut);
|
||||
};
|
||||
});
|
||||
}
|
||||
function CreatePluginTransformerImmediate(): PipelinePlugin {
|
||||
return async (config, input, sink) => {
|
||||
const isObject = config.GetEntry("is-object" as any) === false ? false : true;
|
||||
|
@ -267,6 +285,7 @@ export async function RunPipeline(configView: ConfigurationView, fileSystem: IFi
|
|||
// TODO: replace with OAV again
|
||||
"semantic-validator": CreatePluginIdentity(),
|
||||
|
||||
"openapi-document-converter": CreatePluginOAI2toOAIx(),
|
||||
"commonmarker": CreateCommonmarkProcessor(),
|
||||
"emitter": CreateArtifactEmitter(),
|
||||
"pipeline-emitter": CreateArtifactEmitter(async () => new QuickDataSource([await configView.DataStore.getDataSink().WriteObject("pipeline", pipeline.pipeline)])),
|
||||
|
|
|
@ -28,7 +28,8 @@ import { MergeYamls, IdentitySourceMapping } from "../source-map/merging";
|
|||
let ctr = 0;
|
||||
|
||||
function isReferenceNode(node: YAMLNodeWithPath): boolean {
|
||||
return node.path[node.path.length - 1] === "$ref" && typeof node.node.value === "string";
|
||||
const lastKey = node.path[node.path.length - 1];
|
||||
return (lastKey === "$ref" || lastKey === "x-ms-odata") && typeof node.node.value === "string";
|
||||
}
|
||||
|
||||
async function EnsureCompleteDefinitionIsPresent(
|
||||
|
|
|
@ -8,7 +8,7 @@ import * as jsonpath from "jsonpath";
|
|||
|
||||
// patch in smart filter expressions
|
||||
const handlers = (jsonpath as any).handlers;
|
||||
handlers.register("subscript-descendant-filter_expression", function (component: any, partial: any, count: any) {
|
||||
const filterExpressionHandler = function (component: any, partial: any, count: any) {
|
||||
var src = component.expression.value.slice(1);
|
||||
|
||||
var passable = function (key: any, value: any) {
|
||||
|
@ -20,7 +20,9 @@ handlers.register("subscript-descendant-filter_expression", function (component:
|
|||
}
|
||||
|
||||
return eval("this").traverse(partial, null, passable, count);
|
||||
});
|
||||
};
|
||||
handlers.register("subscript-descendant-filter_expression", filterExpressionHandler);
|
||||
handlers.register("subscript-child-filter_expression", filterExpressionHandler);
|
||||
// patch end
|
||||
|
||||
export type JsonPathComponent = jsonpath.PathComponent;
|
||||
|
|
|
@ -164,6 +164,28 @@ export function StringifyAst(ast: YAMLNode): string {
|
|||
export function Clone<T>(object: T): T {
|
||||
return Parse<T>(FastStringify(object));
|
||||
}
|
||||
/**
|
||||
* Normalizes the order of given object's keys (sorts recursively)
|
||||
*/
|
||||
export function Normalize<T>(object: T): T {
|
||||
const clone = Clone<T>(object);
|
||||
const norm = (o: any) => {
|
||||
if (Array.isArray(o)) {
|
||||
o.forEach(norm);
|
||||
} else if (o && typeof o == "object") {
|
||||
const keys = Object.keys(o).sort();
|
||||
const oo = { ...o };
|
||||
for (const k of keys) {
|
||||
delete o[k];
|
||||
}
|
||||
for (const k of keys) {
|
||||
norm(o[k] = oo[k]);
|
||||
}
|
||||
}
|
||||
};
|
||||
norm(clone);
|
||||
return clone;
|
||||
}
|
||||
export function ToAst<T>(object: T): YAMLNode {
|
||||
return ParseToAst(FastStringify(object));
|
||||
}
|
||||
|
|
|
@ -53,12 +53,13 @@
|
|||
"file-url": "^2.0.2",
|
||||
"js-yaml": "^3.8.4",
|
||||
"get-uri": "^2.0.0",
|
||||
"jsonpath": "^0.2.11",
|
||||
"jsonpath": "1.0.0",
|
||||
"linq-es2015": "^2.4.25",
|
||||
"pify": "^3.0.0",
|
||||
"safe-eval": "^0.3.0",
|
||||
"source-map": "^0.5.6",
|
||||
"strip-bom": "^3.0.0",
|
||||
"swagger2openapi": "olydis/swagger2openapi#autorest-flavor",
|
||||
"untildify": "^3.0.2",
|
||||
"urijs": "^1.18.10",
|
||||
"vscode-jsonrpc": "^3.3.1",
|
||||
|
|
|
@ -147,8 +147,18 @@ pipeline:
|
|||
input: transform
|
||||
output-artifact: swagger-document
|
||||
swagger-document/emitter:
|
||||
input: transform
|
||||
input: identity
|
||||
scope: scope-swagger-document/emitter
|
||||
# OpenAPI
|
||||
openapi-document/openapi-document-converter:
|
||||
input: swagger-document/identity
|
||||
output-artifact: openapi-document
|
||||
openapi-document/identity:
|
||||
input: openapi-document-converter
|
||||
output-artifact: openapi-document
|
||||
openapi-document/emitter:
|
||||
input: identity
|
||||
scope: scope-openapi-document/emitter
|
||||
|
||||
scope-swagger-document/emitter:
|
||||
input-artifact: swagger-document
|
||||
|
@ -158,6 +168,14 @@ scope-swagger-document/emitter:
|
|||
$config["output-file"] ||
|
||||
($config.namespace ? $config.namespace.replace(/:/g,'_') : undefined) ||
|
||||
$config["input-file"][0].split('/').reverse()[0].split('\\').reverse()[0].replace(/\.json$/, "")
|
||||
scope-openapi-document/emitter:
|
||||
input-artifact: openapi-document
|
||||
is-object: true
|
||||
# rethink that output-file part
|
||||
output-uri-expr: |
|
||||
$config["output-file"] ||
|
||||
($config.namespace ? $config.namespace.replace(/:/g,'_') : undefined) ||
|
||||
$config["input-file"][0].split('/').reverse()[0].split('\\').reverse()[0].replace(/\.json$/, "")
|
||||
scope-cm/emitter:
|
||||
input-artifact: code-model-v1
|
||||
is-object: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче