Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Generated from 40858f2b62c42577e6d834ceac599d41fdcc08d3 (#3022)
Browse files Browse the repository at this point in the history
Fix the validation Check for apiId parameter in the productapis
  • Loading branch information
AutorestCI authored Jun 19, 2018
1 parent 918599e commit 7bd148d
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 49 deletions.
8 changes: 4 additions & 4 deletions lib/services/apimanagement/lib/models/errorResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const models = require('./index');

/**
* Error Body contract.
* Error Response.
*
*/
class ErrorResponse {
Expand Down Expand Up @@ -44,21 +44,21 @@ class ErrorResponse {
modelProperties: {
code: {
required: false,
serializedName: 'code',
serializedName: 'error.code',
type: {
name: 'String'
}
},
message: {
required: false,
serializedName: 'message',
serializedName: 'error.message',
type: {
name: 'String'
}
},
details: {
required: false,
serializedName: 'details',
serializedName: 'error.details',
type: {
name: 'Sequence',
element: {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/apimanagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ErrorFieldContract {
* @class
* Initializes a new instance of the ErrorResponse class.
* @constructor
* Error Body contract.
* Error Response.
*
* @member {string} [code] Service-defined error code. This code serves as a
* sub-status for the HTTP error code specified in the response.
Expand Down
30 changes: 18 additions & 12 deletions lib/services/apimanagement/lib/operations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17813,8 +17813,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand All @@ -17840,8 +17841,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -17884,8 +17886,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand All @@ -17910,8 +17913,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -17955,8 +17959,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand All @@ -17981,8 +17986,9 @@ export interface ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down
69 changes: 39 additions & 30 deletions lib/services/apimanagement/lib/operations/productApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ function _listByProduct(resourceGroupName, serviceName, productId, options, call
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -331,17 +332,17 @@ function _checkEntityExists(resourceGroupName, serviceName, productId, apiId, op
throw new Error('apiId cannot be null or undefined and it must be of type string.');
}
if (apiId !== null && apiId !== undefined) {
if (apiId.length > 80)
if (apiId.length > 256)
{
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80');
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256');
}
if (apiId.length < 1)
{
throw new Error('"apiId" should satisfy the constraint - "MinLength": 1');
}
if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null)
if (apiId.match(/^[^*#&+:<>?]+$/) === null)
{
throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/');
throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/');
}
}
if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
Expand Down Expand Up @@ -443,8 +444,9 @@ function _checkEntityExists(resourceGroupName, serviceName, productId, apiId, op
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -517,17 +519,17 @@ function _createOrUpdate(resourceGroupName, serviceName, productId, apiId, optio
throw new Error('apiId cannot be null or undefined and it must be of type string.');
}
if (apiId !== null && apiId !== undefined) {
if (apiId.length > 80)
if (apiId.length > 256)
{
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80');
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256');
}
if (apiId.length < 1)
{
throw new Error('"apiId" should satisfy the constraint - "MinLength": 1');
}
if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null)
if (apiId.match(/^[^*#&+:<>?]+$/) === null)
{
throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/');
throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/');
}
}
if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
Expand Down Expand Up @@ -662,8 +664,9 @@ function _createOrUpdate(resourceGroupName, serviceName, productId, apiId, optio
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -735,17 +738,17 @@ function _deleteMethod(resourceGroupName, serviceName, productId, apiId, options
throw new Error('apiId cannot be null or undefined and it must be of type string.');
}
if (apiId !== null && apiId !== undefined) {
if (apiId.length > 80)
if (apiId.length > 256)
{
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80');
throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256');
}
if (apiId.length < 1)
{
throw new Error('"apiId" should satisfy the constraint - "MinLength": 1');
}
if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null)
if (apiId.match(/^[^*#&+:<>?]+$/) === null)
{
throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/');
throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/');
}
}
if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
Expand Down Expand Up @@ -1120,8 +1123,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -1159,8 +1163,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -1218,8 +1223,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -1256,8 +1262,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -1316,8 +1323,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down Expand Up @@ -1354,8 +1362,9 @@ class ProductApi {
* @param {string} productId Product identifier. Must be unique in the current
* API Management service instance.
*
* @param {string} apiId API identifier. Must be unique in the current API
* Management service instance.
* @param {string} apiId API revision identifier. Must be unique in the current
* API Management service instance. Non-current revision has ;rev=n as a suffix
* where n is the revision number.
*
* @param {object} [options] Optional Parameters.
*
Expand Down
7 changes: 5 additions & 2 deletions lib/services/apimanagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
"description": "ApiManagementClient Library with typescript type definitions for node",
"version": "2.1.0-preview",
"dependencies": {
"ms-rest": "^2.3.2",
"ms-rest": "^2.3.3",
"ms-rest-azure": "^2.5.5"
},
"keywords": [ "node", "azure" ],
"keywords": [
"node",
"azure"
],
"license": "MIT",
"main": "./lib/apiManagementClient.js",
"types": "./lib/apiManagementClient.d.ts",
Expand Down

0 comments on commit 7bd148d

Please sign in to comment.