diff --git a/.gulp/regeneration.iced b/.gulp/regeneration.iced index 22ed212..933e3f5 100644 --- a/.gulp/regeneration.iced +++ b/.gulp/regeneration.iced @@ -15,8 +15,8 @@ regenExpected = (opts,done) -> args = [ "--standalone-modeler", "--clear-output-folder", - "--output-artifact=code-model-v1.yaml", - "--output-artifact=code-model-v1-yaml.yaml", + "--output-artifact=code-model-v1.norm.yaml", + "--output-artifact=code-model-v1-yaml.norm.yaml", "--output-folder=#{opts.outputDir}/#{key}" ] diff --git a/package.json b/package.json index f7e6772..9ec262f 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/Azure/autorest.modeler/blob/master/README.md", "devDependencies": { - "@microsoft.azure/autorest.testserver": "2.3.1", - "autorest": "^2.0.4201", + "@microsoft.azure/autorest.testserver": "2.3.14", + "autorest": "^2.0.4215", "coffee-script": "^1.11.1", "dotnet-sdk-2.0.0": "^1.4.4", "gulp": "^3.9.1", diff --git a/src/Model/RequestBody.cs b/src/Model/RequestBody.cs index 28b157f..a7a1d7b 100644 --- a/src/Model/RequestBody.cs +++ b/src/Model/RequestBody.cs @@ -43,20 +43,23 @@ namespace AutoRest.Modeler.Model Name = prop.Key, IsRequired = schema.Required?.Contains(prop.Key) ?? false, Schema = prop.Value, - Extensions = schema.Extensions + Extensions = schema.Extensions, + Style = prop.Value?.Style }); } else // => in: body { + var schema = Content?.Values.FirstOrDefault()?.Schema; var p = new SwaggerParameter { Description = Description, In = ParameterLocation.Body, Name = Extensions.GetValue("x-ms-requestBody-name") ?? "body", IsRequired = Required, - Schema = Content?.Values.FirstOrDefault()?.Schema, + Schema = schema, Reference = Reference, - Extensions = Extensions + Extensions = Extensions, + Style = schema?.Style }; asParamCache = new [] { p }; } diff --git a/src/Model/Schema.cs b/src/Model/Schema.cs index 760cb51..4e479a1 100644 --- a/src/Model/Schema.cs +++ b/src/Model/Schema.cs @@ -37,6 +37,8 @@ namespace AutoRest.Modeler.Model public object Example { get; set; } + public ParameterStyle? Style { get; set; } // for backwards compat. with 2.0 - properties can have "style" to encode things like form data collection format + /// /// The value of this property MUST be another schema which will provide /// a base schema which the current schema will inherit from. The diff --git a/test/Expected/azure-parameter-grouping/code-model-v1-yaml.yaml b/test/Expected/azure-parameter-grouping/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/azure-parameter-grouping/code-model-v1-yaml.yaml rename to test/Expected/azure-parameter-grouping/code-model-v1-yaml.norm.yaml index 5d9d5d3..adc12fd 100644 --- a/test/Expected/azure-parameter-grouping/code-model-v1-yaml.yaml +++ b/test/Expected/azure-parameter-grouping/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -160,8 +160,7 @@ operations: fixed: false raw: Path parameter extensions: - x-ms-parameter-grouping: - value: true + x-ms-parameter-grouping: {} isConstant: false isRequired: true location: path diff --git a/test/Expected/azure-parameter-grouping/code-model-v1.yaml b/test/Expected/azure-parameter-grouping/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/azure-parameter-grouping/code-model-v1.yaml rename to test/Expected/azure-parameter-grouping/code-model-v1.norm.yaml index 40c39b9..2e16a0c 100644 --- a/test/Expected/azure-parameter-grouping/code-model-v1.yaml +++ b/test/Expected/azure-parameter-grouping/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -172,8 +172,7 @@ operations: fixed: false raw: Path parameter extensions: - x-ms-parameter-grouping: - value: true + x-ms-parameter-grouping: {} isConstant: false isRequired: true location: path diff --git a/test/Expected/azure-report/code-model-v1-yaml.yaml b/test/Expected/azure-report/code-model-v1-yaml.norm.yaml similarity index 74% rename from test/Expected/azure-report/code-model-v1-yaml.yaml rename to test/Expected/azure-report/code-model-v1-yaml.norm.yaml index d995d44..a9ad821 100644 --- a/test/Expected/azure-report/code-model-v1-yaml.yaml +++ b/test/Expected/azure-report/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -78,6 +78,32 @@ operations: name: fixed: false raw: getReport + parameters: + - collectionFormat: none + defaultValue: + fixed: false + deprecated: false + documentation: + fixed: false + raw: >- + If specified, qualifies the generated report further (e.g. '2.7' + vs '3.5' in for Python). The only effect is, that generators + that run all tests several times, can distinguish the generated + reports. + isConstant: false + isRequired: false + location: query + modelType: + $type: PrimaryType + deprecated: false + knownPrimaryType: string + name: + fixed: false + raw: String + name: + fixed: false + raw: qualifier + serializedName: qualifier requestContentType: application/json; charset=utf-8 responseContentTypes: - application/json diff --git a/test/Expected/azure-report/code-model-v1.yaml b/test/Expected/azure-report/code-model-v1.norm.yaml similarity index 72% rename from test/Expected/azure-report/code-model-v1.yaml rename to test/Expected/azure-report/code-model-v1.norm.yaml index 7d6f2f8..7637b42 100644 --- a/test/Expected/azure-report/code-model-v1.yaml +++ b/test/Expected/azure-report/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -83,20 +83,48 @@ operations: name: fixed: false raw: getReport + parameters: + - $id: '6' + collectionFormat: none + defaultValue: + fixed: false + deprecated: false + documentation: + fixed: false + raw: >- + If specified, qualifies the generated report further (e.g. '2.7' + vs '3.5' in for Python). The only effect is, that generators + that run all tests several times, can distinguish the generated + reports. + isConstant: false + isRequired: false + location: query + modelType: + $id: '7' + $type: PrimaryType + deprecated: false + knownPrimaryType: string + name: + fixed: false + raw: String + name: + fixed: false + raw: qualifier + serializedName: qualifier requestContentType: application/json; charset=utf-8 responseContentTypes: - application/json responses: OK: body: - $id: '6' + $id: '8' $type: DictionaryType deprecated: false name: fixed: false supportsAdditionalProperties: false valueType: - $id: '7' + $id: '9' $type: PrimaryType deprecated: false knownPrimaryType: int @@ -106,7 +134,7 @@ operations: isNullable: true returnType: body: - $ref: '6' + $ref: '8' isNullable: true serializedName: getReport url: /report/azure diff --git a/test/Expected/azure-resource-x/code-model-v1-yaml.yaml b/test/Expected/azure-resource-x/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/azure-resource-x/code-model-v1-yaml.yaml rename to test/Expected/azure-resource-x/code-model-v1-yaml.norm.yaml index 05bbac8..2f94f84 100644 --- a/test/Expected/azure-resource-x/code-model-v1-yaml.yaml +++ b/test/Expected/azure-resource-x/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/azure-resource-x/code-model-v1.yaml b/test/Expected/azure-resource-x/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/azure-resource-x/code-model-v1.yaml rename to test/Expected/azure-resource-x/code-model-v1.norm.yaml index 1e34c58..6383c27 100644 --- a/test/Expected/azure-resource-x/code-model-v1.yaml +++ b/test/Expected/azure-resource-x/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/azure-resource/code-model-v1-yaml.yaml b/test/Expected/azure-resource/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/azure-resource/code-model-v1-yaml.yaml rename to test/Expected/azure-resource/code-model-v1-yaml.norm.yaml index bfa7d86..00cf933 100644 --- a/test/Expected/azure-resource/code-model-v1-yaml.yaml +++ b/test/Expected/azure-resource/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/azure-resource/code-model-v1.yaml b/test/Expected/azure-resource/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/azure-resource/code-model-v1.yaml rename to test/Expected/azure-resource/code-model-v1.norm.yaml index c4be8c5..be7d2c5 100644 --- a/test/Expected/azure-resource/code-model-v1.yaml +++ b/test/Expected/azure-resource/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/azure-special-properties/code-model-v1-yaml.yaml b/test/Expected/azure-special-properties/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/azure-special-properties/code-model-v1-yaml.yaml rename to test/Expected/azure-special-properties/code-model-v1-yaml.norm.yaml index af66dde..8115520 100644 --- a/test/Expected/azure-special-properties/code-model-v1-yaml.yaml +++ b/test/Expected/azure-special-properties/code-model-v1-yaml.norm.yaml @@ -1,15 +1,12 @@ --- apiVersion: 2015-07-01-preview -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 $type: CompositeType - containsConstantProperties: false + containsConstantProperties: true deprecated: false - extensions: - requiredProperties: - - constantId name: fixed: false raw: Error @@ -40,12 +37,13 @@ errorTypes: - collectionFormat: none defaultValue: fixed: false + raw: '1' deprecated: false documentation: fixed: false - isConstant: false + isConstant: true isReadOnly: false - isRequired: false + isRequired: true modelType: $type: PrimaryType deprecated: false diff --git a/test/Expected/azure-special-properties/code-model-v1.yaml b/test/Expected/azure-special-properties/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/azure-special-properties/code-model-v1.yaml rename to test/Expected/azure-special-properties/code-model-v1.norm.yaml index e06ca67..918485e 100644 --- a/test/Expected/azure-special-properties/code-model-v1.yaml +++ b/test/Expected/azure-special-properties/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 2015-07-01-preview -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -113,11 +113,8 @@ headerTypes: modelTypes: - $id: '1' $type: CompositeType - containsConstantProperties: false + containsConstantProperties: true deprecated: false - extensions: - requiredProperties: - - constantId name: fixed: false raw: Error @@ -151,12 +148,13 @@ modelTypes: collectionFormat: none defaultValue: fixed: false + raw: '1' deprecated: false documentation: fixed: false - isConstant: false + isConstant: true isReadOnly: false - isRequired: false + isRequired: true modelType: $id: '5' $type: PrimaryType diff --git a/test/Expected/body-array/code-model-v1-yaml.yaml b/test/Expected/body-array/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-array/code-model-v1-yaml.yaml rename to test/Expected/body-array/code-model-v1-yaml.norm.yaml index e020ada..0c3f36e 100644 --- a/test/Expected/body-array/code-model-v1-yaml.yaml +++ b/test/Expected/body-array/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - &ref_0 diff --git a/test/Expected/body-array/code-model-v1.yaml b/test/Expected/body-array/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-array/code-model-v1.yaml rename to test/Expected/body-array/code-model-v1.norm.yaml index 2ae03ad..897dc40 100644 --- a/test/Expected/body-array/code-model-v1.yaml +++ b/test/Expected/body-array/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - $ref: '6' diff --git a/test/Expected/body-boolean.quirks/code-model-v1-yaml.yaml b/test/Expected/body-boolean.quirks/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-boolean.quirks/code-model-v1-yaml.yaml rename to test/Expected/body-boolean.quirks/code-model-v1-yaml.norm.yaml index 2c9dcf5..09887ab 100644 --- a/test/Expected/body-boolean.quirks/code-model-v1-yaml.yaml +++ b/test/Expected/body-boolean.quirks/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-boolean.quirks/code-model-v1.yaml b/test/Expected/body-boolean.quirks/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-boolean.quirks/code-model-v1.yaml rename to test/Expected/body-boolean.quirks/code-model-v1.norm.yaml index 65b7103..1cf8069 100644 --- a/test/Expected/body-boolean.quirks/code-model-v1.yaml +++ b/test/Expected/body-boolean.quirks/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-boolean/code-model-v1-yaml.yaml b/test/Expected/body-boolean/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-boolean/code-model-v1-yaml.yaml rename to test/Expected/body-boolean/code-model-v1-yaml.norm.yaml index 1bcaa04..c0962da 100644 --- a/test/Expected/body-boolean/code-model-v1-yaml.yaml +++ b/test/Expected/body-boolean/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-boolean/code-model-v1.yaml b/test/Expected/body-boolean/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-boolean/code-model-v1.yaml rename to test/Expected/body-boolean/code-model-v1.norm.yaml index b1498ca..fb48a75 100644 --- a/test/Expected/body-boolean/code-model-v1.yaml +++ b/test/Expected/body-boolean/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-byte/code-model-v1-yaml.yaml b/test/Expected/body-byte/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-byte/code-model-v1-yaml.yaml rename to test/Expected/body-byte/code-model-v1-yaml.norm.yaml index 5bf39ce..01ce51a 100644 --- a/test/Expected/body-byte/code-model-v1-yaml.yaml +++ b/test/Expected/body-byte/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - &ref_0 diff --git a/test/Expected/body-byte/code-model-v1.yaml b/test/Expected/body-byte/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-byte/code-model-v1.yaml rename to test/Expected/body-byte/code-model-v1.norm.yaml index 347daa4..c763c9a 100644 --- a/test/Expected/body-byte/code-model-v1.yaml +++ b/test/Expected/body-byte/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - $ref: '1' diff --git a/test/Expected/body-complex/code-model-v1-yaml.yaml b/test/Expected/body-complex/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-complex/code-model-v1-yaml.yaml rename to test/Expected/body-complex/code-model-v1-yaml.norm.yaml index 802a01a..1462fd7 100644 --- a/test/Expected/body-complex/code-model-v1-yaml.yaml +++ b/test/Expected/body-complex/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: '2016-02-29' -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - &ref_1 diff --git a/test/Expected/body-complex/code-model-v1.yaml b/test/Expected/body-complex/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-complex/code-model-v1.yaml rename to test/Expected/body-complex/code-model-v1.norm.yaml index 52ca2b6..bf605b5 100644 --- a/test/Expected/body-complex/code-model-v1.yaml +++ b/test/Expected/body-complex/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: '2016-02-29' -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - $ref: '12' diff --git a/test/Expected/body-date/code-model-v1-yaml.yaml b/test/Expected/body-date/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-date/code-model-v1-yaml.yaml rename to test/Expected/body-date/code-model-v1-yaml.norm.yaml index 419862c..84d7dc5 100644 --- a/test/Expected/body-date/code-model-v1-yaml.yaml +++ b/test/Expected/body-date/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-date/code-model-v1.yaml b/test/Expected/body-date/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-date/code-model-v1.yaml rename to test/Expected/body-date/code-model-v1.norm.yaml index 5f4af2c..0d8dceb 100644 --- a/test/Expected/body-date/code-model-v1.yaml +++ b/test/Expected/body-date/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-datetime-rfc1123/code-model-v1-yaml.yaml b/test/Expected/body-datetime-rfc1123/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-datetime-rfc1123/code-model-v1-yaml.yaml rename to test/Expected/body-datetime-rfc1123/code-model-v1-yaml.norm.yaml index 2a8a58d..41c1e94 100644 --- a/test/Expected/body-datetime-rfc1123/code-model-v1-yaml.yaml +++ b/test/Expected/body-datetime-rfc1123/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-datetime-rfc1123/code-model-v1.yaml b/test/Expected/body-datetime-rfc1123/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-datetime-rfc1123/code-model-v1.yaml rename to test/Expected/body-datetime-rfc1123/code-model-v1.norm.yaml index 5e2f081..e9fb579 100644 --- a/test/Expected/body-datetime-rfc1123/code-model-v1.yaml +++ b/test/Expected/body-datetime-rfc1123/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-datetime/code-model-v1-yaml.yaml b/test/Expected/body-datetime/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-datetime/code-model-v1-yaml.yaml rename to test/Expected/body-datetime/code-model-v1-yaml.norm.yaml index 1aff553..95c58cd 100644 --- a/test/Expected/body-datetime/code-model-v1-yaml.yaml +++ b/test/Expected/body-datetime/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-datetime/code-model-v1.yaml b/test/Expected/body-datetime/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-datetime/code-model-v1.yaml rename to test/Expected/body-datetime/code-model-v1.norm.yaml index e43b8c3..0a076b7 100644 --- a/test/Expected/body-datetime/code-model-v1.yaml +++ b/test/Expected/body-datetime/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-dictionary/code-model-v1-yaml.yaml b/test/Expected/body-dictionary/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-dictionary/code-model-v1-yaml.yaml rename to test/Expected/body-dictionary/code-model-v1-yaml.norm.yaml index 17c43e7..e63e365 100644 --- a/test/Expected/body-dictionary/code-model-v1-yaml.yaml +++ b/test/Expected/body-dictionary/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - &ref_0 diff --git a/test/Expected/body-dictionary/code-model-v1.yaml b/test/Expected/body-dictionary/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-dictionary/code-model-v1.yaml rename to test/Expected/body-dictionary/code-model-v1.norm.yaml index 12a543b..53a716d 100644 --- a/test/Expected/body-dictionary/code-model-v1.yaml +++ b/test/Expected/body-dictionary/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - $ref: '6' diff --git a/test/Expected/body-duration/code-model-v1-yaml.yaml b/test/Expected/body-duration/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-duration/code-model-v1-yaml.yaml rename to test/Expected/body-duration/code-model-v1-yaml.norm.yaml index 95d69fc..e73e0f8 100644 --- a/test/Expected/body-duration/code-model-v1-yaml.yaml +++ b/test/Expected/body-duration/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-duration/code-model-v1.yaml b/test/Expected/body-duration/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-duration/code-model-v1.yaml rename to test/Expected/body-duration/code-model-v1.norm.yaml index d755402..bf03070 100644 --- a/test/Expected/body-duration/code-model-v1.yaml +++ b/test/Expected/body-duration/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-file/code-model-v1-yaml.yaml b/test/Expected/body-file/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-file/code-model-v1-yaml.yaml rename to test/Expected/body-file/code-model-v1-yaml.norm.yaml index 9075223..b171617 100644 --- a/test/Expected/body-file/code-model-v1-yaml.yaml +++ b/test/Expected/body-file/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - &ref_0 diff --git a/test/Expected/body-file/code-model-v1.yaml b/test/Expected/body-file/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-file/code-model-v1.yaml rename to test/Expected/body-file/code-model-v1.norm.yaml index 9ded09a..3aea27c 100644 --- a/test/Expected/body-file/code-model-v1.yaml +++ b/test/Expected/body-file/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - $ref: '1' diff --git a/test/Expected/body-formdata-urlencoded/code-model-v1-yaml.yaml b/test/Expected/body-formdata-urlencoded/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/body-formdata-urlencoded/code-model-v1-yaml.yaml rename to test/Expected/body-formdata-urlencoded/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/body-formdata-urlencoded/code-model-v1.yaml b/test/Expected/body-formdata-urlencoded/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/body-formdata-urlencoded/code-model-v1.yaml rename to test/Expected/body-formdata-urlencoded/code-model-v1.norm.yaml diff --git a/test/Expected/body-formdata/code-model-v1-yaml.yaml b/test/Expected/body-formdata/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-formdata/code-model-v1-yaml.yaml rename to test/Expected/body-formdata/code-model-v1-yaml.norm.yaml index 8fbb2a9..066511b 100644 --- a/test/Expected/body-formdata/code-model-v1-yaml.yaml +++ b/test/Expected/body-formdata/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - &ref_0 diff --git a/test/Expected/body-formdata/code-model-v1.yaml b/test/Expected/body-formdata/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-formdata/code-model-v1.yaml rename to test/Expected/body-formdata/code-model-v1.norm.yaml index 5263f30..94a74b3 100644 --- a/test/Expected/body-formdata/code-model-v1.yaml +++ b/test/Expected/body-formdata/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT errorTypes: - $ref: '1' diff --git a/test/Expected/body-integer/code-model-v1-yaml.yaml b/test/Expected/body-integer/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-integer/code-model-v1-yaml.yaml rename to test/Expected/body-integer/code-model-v1-yaml.norm.yaml index 45d7ca4..08d73ed 100644 --- a/test/Expected/body-integer/code-model-v1-yaml.yaml +++ b/test/Expected/body-integer/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-integer/code-model-v1.yaml b/test/Expected/body-integer/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-integer/code-model-v1.yaml rename to test/Expected/body-integer/code-model-v1.norm.yaml index e815127..f3ca5ba 100644 --- a/test/Expected/body-integer/code-model-v1.yaml +++ b/test/Expected/body-integer/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-number.quirks/code-model-v1-yaml.yaml b/test/Expected/body-number.quirks/code-model-v1-yaml.norm.yaml similarity index 96% rename from test/Expected/body-number.quirks/code-model-v1-yaml.yaml rename to test/Expected/body-number.quirks/code-model-v1-yaml.norm.yaml index cee03f0..55c1161 100644 --- a/test/Expected/body-number.quirks/code-model-v1-yaml.yaml +++ b/test/Expected/body-number.quirks/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -162,39 +162,6 @@ operations: isNullable: true serializedName: number_getInvalidDouble url: /number/invaliddouble - - defaultResponse: - body: *ref_0 - isNullable: true - deprecated: false - description: Get invalid decimal Number value - group: - fixed: false - raw: number - hidden: false - httpMethod: get - isAbsoluteUrl: false - name: - fixed: false - raw: getInvalidDecimal - requestContentType: application/json; charset=utf-8 - responseContentTypes: - - application/json - responses: - OK: - body: &ref_4 - $type: PrimaryType - deprecated: false - format: decimal - knownPrimaryType: decimal - name: - fixed: false - raw: Decimal - isNullable: true - returnType: - body: *ref_4 - isNullable: true - serializedName: number_getInvalidDecimal - url: /number/invaliddecimal - defaultResponse: body: *ref_0 isNullable: true @@ -264,7 +231,7 @@ operations: - application/json responses: OK: - body: &ref_5 + body: &ref_4 $type: PrimaryType deprecated: false format: float @@ -274,7 +241,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_5 + body: *ref_4 isNullable: true serializedName: number_getBigFloat url: /number/big/float/3.402823e+20 @@ -347,7 +314,7 @@ operations: - application/json responses: OK: - body: &ref_6 + body: &ref_5 $type: PrimaryType deprecated: false format: double @@ -357,7 +324,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_6 + body: *ref_5 isNullable: true serializedName: number_getBigDouble url: /number/big/double/2.5976931e+101 @@ -430,7 +397,7 @@ operations: - application/json responses: OK: - body: &ref_7 + body: &ref_6 $type: PrimaryType deprecated: false format: double @@ -440,7 +407,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_7 + body: *ref_6 isNullable: true serializedName: number_getBigDoublePositiveDecimal url: /number/big/double/99999999.99 @@ -513,7 +480,7 @@ operations: - application/json responses: OK: - body: &ref_8 + body: &ref_7 $type: PrimaryType deprecated: false format: double @@ -523,7 +490,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_8 + body: *ref_7 isNullable: true serializedName: number_getBigDoubleNegativeDecimal url: /number/big/double/-99999999.99 @@ -596,7 +563,7 @@ operations: - application/json responses: OK: - body: &ref_9 + body: &ref_8 $type: PrimaryType deprecated: false format: decimal @@ -606,7 +573,7 @@ operations: raw: Decimal isNullable: true returnType: - body: *ref_9 + body: *ref_8 isNullable: true serializedName: number_getBigDecimal url: /number/big/decimal/2.5976931e+101 @@ -679,7 +646,7 @@ operations: - application/json responses: OK: - body: &ref_10 + body: &ref_9 $type: PrimaryType deprecated: false format: decimal @@ -689,7 +656,7 @@ operations: raw: Decimal isNullable: true returnType: - body: *ref_10 + body: *ref_9 isNullable: true serializedName: number_getBigDecimalPositiveDecimal url: /number/big/decimal/99999999.99 @@ -762,7 +729,7 @@ operations: - application/json responses: OK: - body: &ref_11 + body: &ref_10 $type: PrimaryType deprecated: false format: decimal @@ -772,7 +739,7 @@ operations: raw: Decimal isNullable: true returnType: - body: *ref_11 + body: *ref_10 isNullable: true serializedName: number_getBigDecimalNegativeDecimal url: /number/big/decimal/-99999999.99 @@ -845,7 +812,7 @@ operations: - application/json responses: OK: - body: &ref_12 + body: &ref_11 $type: PrimaryType deprecated: false format: double @@ -855,7 +822,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_12 + body: *ref_11 isNullable: true serializedName: number_getSmallFloat url: /number/small/float/3.402823e-20 @@ -928,7 +895,7 @@ operations: - application/json responses: OK: - body: &ref_13 + body: &ref_12 $type: PrimaryType deprecated: false format: double @@ -938,7 +905,7 @@ operations: raw: Double isNullable: true returnType: - body: *ref_13 + body: *ref_12 isNullable: true serializedName: number_getSmallDouble url: /number/small/double/2.5976931e-101 @@ -1011,7 +978,7 @@ operations: - application/json responses: OK: - body: &ref_14 + body: &ref_13 $type: PrimaryType deprecated: false format: decimal @@ -1021,7 +988,7 @@ operations: raw: Decimal isNullable: true returnType: - body: *ref_14 + body: *ref_13 isNullable: true serializedName: number_getSmallDecimal url: /number/small/decimal/2.5976931e-101 diff --git a/test/Expected/body-number.quirks/code-model-v1.yaml b/test/Expected/body-number.quirks/code-model-v1.norm.yaml similarity index 94% rename from test/Expected/body-number.quirks/code-model-v1.yaml rename to test/Expected/body-number.quirks/code-model-v1.norm.yaml index f575a3f..617cf49 100644 --- a/test/Expected/body-number.quirks/code-model-v1.yaml +++ b/test/Expected/body-number.quirks/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -175,42 +175,6 @@ operations: isNullable: true serializedName: number_getInvalidDouble url: /number/invaliddouble - - defaultResponse: - body: - $ref: '1' - isNullable: true - deprecated: false - description: Get invalid decimal Number value - group: - fixed: false - raw: number - hidden: false - httpMethod: get - isAbsoluteUrl: false - name: - fixed: false - raw: getInvalidDecimal - requestContentType: application/json; charset=utf-8 - responseContentTypes: - - application/json - responses: - OK: - body: - $id: '9' - $type: PrimaryType - deprecated: false - format: decimal - knownPrimaryType: decimal - name: - fixed: false - raw: Decimal - isNullable: true - returnType: - body: - $ref: '9' - isNullable: true - serializedName: number_getInvalidDecimal - url: /number/invaliddecimal - defaultResponse: body: $ref: '1' @@ -229,7 +193,7 @@ operations: fixed: false raw: putBigFloat parameters: - - $id: '10' + - $id: '9' collectionFormat: none defaultValue: fixed: false @@ -242,7 +206,7 @@ operations: isRequired: true location: body modelType: - $id: '11' + $id: '10' $type: PrimaryType deprecated: false format: float @@ -285,7 +249,7 @@ operations: responses: OK: body: - $id: '12' + $id: '11' $type: PrimaryType deprecated: false format: float @@ -296,7 +260,7 @@ operations: isNullable: true returnType: body: - $ref: '12' + $ref: '11' isNullable: true serializedName: number_getBigFloat url: /number/big/float/3.402823e+20 @@ -318,7 +282,7 @@ operations: fixed: false raw: putBigDouble parameters: - - $id: '13' + - $id: '12' collectionFormat: none defaultValue: fixed: false @@ -331,7 +295,7 @@ operations: isRequired: true location: body modelType: - $id: '14' + $id: '13' $type: PrimaryType deprecated: false format: double @@ -374,7 +338,7 @@ operations: responses: OK: body: - $id: '15' + $id: '14' $type: PrimaryType deprecated: false format: double @@ -385,7 +349,7 @@ operations: isNullable: true returnType: body: - $ref: '15' + $ref: '14' isNullable: true serializedName: number_getBigDouble url: /number/big/double/2.5976931e+101 @@ -407,7 +371,7 @@ operations: fixed: false raw: putBigDoublePositiveDecimal parameters: - - $id: '16' + - $id: '15' collectionFormat: none defaultValue: fixed: false @@ -420,7 +384,7 @@ operations: isRequired: true location: body modelType: - $id: '17' + $id: '16' $type: PrimaryType deprecated: false format: double @@ -463,7 +427,7 @@ operations: responses: OK: body: - $id: '18' + $id: '17' $type: PrimaryType deprecated: false format: double @@ -474,7 +438,7 @@ operations: isNullable: true returnType: body: - $ref: '18' + $ref: '17' isNullable: true serializedName: number_getBigDoublePositiveDecimal url: /number/big/double/99999999.99 @@ -496,7 +460,7 @@ operations: fixed: false raw: putBigDoubleNegativeDecimal parameters: - - $id: '19' + - $id: '18' collectionFormat: none defaultValue: fixed: false @@ -509,7 +473,7 @@ operations: isRequired: true location: body modelType: - $id: '20' + $id: '19' $type: PrimaryType deprecated: false format: double @@ -552,7 +516,7 @@ operations: responses: OK: body: - $id: '21' + $id: '20' $type: PrimaryType deprecated: false format: double @@ -563,7 +527,7 @@ operations: isNullable: true returnType: body: - $ref: '21' + $ref: '20' isNullable: true serializedName: number_getBigDoubleNegativeDecimal url: /number/big/double/-99999999.99 @@ -585,7 +549,7 @@ operations: fixed: false raw: putBigDecimal parameters: - - $id: '22' + - $id: '21' collectionFormat: none defaultValue: fixed: false @@ -598,7 +562,7 @@ operations: isRequired: true location: body modelType: - $id: '23' + $id: '22' $type: PrimaryType deprecated: false format: decimal @@ -641,7 +605,7 @@ operations: responses: OK: body: - $id: '24' + $id: '23' $type: PrimaryType deprecated: false format: decimal @@ -652,7 +616,7 @@ operations: isNullable: true returnType: body: - $ref: '24' + $ref: '23' isNullable: true serializedName: number_getBigDecimal url: /number/big/decimal/2.5976931e+101 @@ -674,7 +638,7 @@ operations: fixed: false raw: putBigDecimalPositiveDecimal parameters: - - $id: '25' + - $id: '24' collectionFormat: none defaultValue: fixed: false @@ -687,7 +651,7 @@ operations: isRequired: true location: body modelType: - $id: '26' + $id: '25' $type: PrimaryType deprecated: false format: decimal @@ -730,7 +694,7 @@ operations: responses: OK: body: - $id: '27' + $id: '26' $type: PrimaryType deprecated: false format: decimal @@ -741,7 +705,7 @@ operations: isNullable: true returnType: body: - $ref: '27' + $ref: '26' isNullable: true serializedName: number_getBigDecimalPositiveDecimal url: /number/big/decimal/99999999.99 @@ -763,7 +727,7 @@ operations: fixed: false raw: putBigDecimalNegativeDecimal parameters: - - $id: '28' + - $id: '27' collectionFormat: none defaultValue: fixed: false @@ -776,7 +740,7 @@ operations: isRequired: true location: body modelType: - $id: '29' + $id: '28' $type: PrimaryType deprecated: false format: decimal @@ -819,7 +783,7 @@ operations: responses: OK: body: - $id: '30' + $id: '29' $type: PrimaryType deprecated: false format: decimal @@ -830,7 +794,7 @@ operations: isNullable: true returnType: body: - $ref: '30' + $ref: '29' isNullable: true serializedName: number_getBigDecimalNegativeDecimal url: /number/big/decimal/-99999999.99 @@ -852,7 +816,7 @@ operations: fixed: false raw: putSmallFloat parameters: - - $id: '31' + - $id: '30' collectionFormat: none defaultValue: fixed: false @@ -865,7 +829,7 @@ operations: isRequired: true location: body modelType: - $id: '32' + $id: '31' $type: PrimaryType deprecated: false format: float @@ -908,7 +872,7 @@ operations: responses: OK: body: - $id: '33' + $id: '32' $type: PrimaryType deprecated: false format: double @@ -919,7 +883,7 @@ operations: isNullable: true returnType: body: - $ref: '33' + $ref: '32' isNullable: true serializedName: number_getSmallFloat url: /number/small/float/3.402823e-20 @@ -941,7 +905,7 @@ operations: fixed: false raw: putSmallDouble parameters: - - $id: '34' + - $id: '33' collectionFormat: none defaultValue: fixed: false @@ -954,7 +918,7 @@ operations: isRequired: true location: body modelType: - $id: '35' + $id: '34' $type: PrimaryType deprecated: false format: double @@ -997,7 +961,7 @@ operations: responses: OK: body: - $id: '36' + $id: '35' $type: PrimaryType deprecated: false format: double @@ -1008,7 +972,7 @@ operations: isNullable: true returnType: body: - $ref: '36' + $ref: '35' isNullable: true serializedName: number_getSmallDouble url: /number/small/double/2.5976931e-101 @@ -1030,7 +994,7 @@ operations: fixed: false raw: putSmallDecimal parameters: - - $id: '37' + - $id: '36' collectionFormat: none defaultValue: fixed: false @@ -1043,7 +1007,7 @@ operations: isRequired: true location: body modelType: - $id: '38' + $id: '37' $type: PrimaryType deprecated: false format: decimal @@ -1086,7 +1050,7 @@ operations: responses: OK: body: - $id: '39' + $id: '38' $type: PrimaryType deprecated: false format: decimal @@ -1097,7 +1061,7 @@ operations: isNullable: true returnType: body: - $ref: '39' + $ref: '38' isNullable: true serializedName: number_getSmallDecimal url: /number/small/decimal/2.5976931e-101 diff --git a/test/Expected/body-number/code-model-v1-yaml.yaml b/test/Expected/body-number/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-number/code-model-v1-yaml.yaml rename to test/Expected/body-number/code-model-v1-yaml.norm.yaml index 0207ab4..05da556 100644 --- a/test/Expected/body-number/code-model-v1-yaml.yaml +++ b/test/Expected/body-number/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/body-number/code-model-v1.yaml b/test/Expected/body-number/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-number/code-model-v1.yaml rename to test/Expected/body-number/code-model-v1.norm.yaml index 23e2442..919cc94 100644 --- a/test/Expected/body-number/code-model-v1.yaml +++ b/test/Expected/body-number/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/body-string.quirks/code-model-v1-yaml.yaml b/test/Expected/body-string.quirks/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-string.quirks/code-model-v1-yaml.yaml rename to test/Expected/body-string.quirks/code-model-v1-yaml.norm.yaml index b946569..6508dac 100644 --- a/test/Expected/body-string.quirks/code-model-v1-yaml.yaml +++ b/test/Expected/body-string.quirks/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT enumTypes: - &ref_9 diff --git a/test/Expected/body-string.quirks/code-model-v1.yaml b/test/Expected/body-string.quirks/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-string.quirks/code-model-v1.yaml rename to test/Expected/body-string.quirks/code-model-v1.norm.yaml index 56bd586..0b7a0bf 100644 --- a/test/Expected/body-string.quirks/code-model-v1.yaml +++ b/test/Expected/body-string.quirks/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT enumTypes: - $id: '11' diff --git a/test/Expected/body-string/code-model-v1-yaml.yaml b/test/Expected/body-string/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/body-string/code-model-v1-yaml.yaml rename to test/Expected/body-string/code-model-v1-yaml.norm.yaml index eb70614..5a6263e 100644 --- a/test/Expected/body-string/code-model-v1-yaml.yaml +++ b/test/Expected/body-string/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT enumTypes: - &ref_9 diff --git a/test/Expected/body-string/code-model-v1.yaml b/test/Expected/body-string/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/body-string/code-model-v1.yaml rename to test/Expected/body-string/code-model-v1.norm.yaml index f040ee7..f3bece7 100644 --- a/test/Expected/body-string/code-model-v1.yaml +++ b/test/Expected/body-string/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest Swagger BAT enumTypes: - $id: '11' diff --git a/test/Expected/complex-model/code-model-v1-yaml.yaml b/test/Expected/complex-model/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/complex-model/code-model-v1-yaml.yaml rename to test/Expected/complex-model/code-model-v1-yaml.norm.yaml index 75d423b..3c266f3 100644 --- a/test/Expected/complex-model/code-model-v1-yaml.yaml +++ b/test/Expected/complex-model/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 2014-04-01-preview -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Some cool documentation. errorTypes: - &ref_1 diff --git a/test/Expected/complex-model/code-model-v1.yaml b/test/Expected/complex-model/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/complex-model/code-model-v1.yaml rename to test/Expected/complex-model/code-model-v1.norm.yaml index c0281c4..d666ce2 100644 --- a/test/Expected/complex-model/code-model-v1.yaml +++ b/test/Expected/complex-model/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 2014-04-01-preview -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Some cool documentation. errorTypes: - $ref: '26' diff --git a/test/Expected/custom-baseUrl-more-options/code-model-v1-yaml.yaml b/test/Expected/custom-baseUrl-more-options/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/custom-baseUrl-more-options/code-model-v1-yaml.yaml rename to test/Expected/custom-baseUrl-more-options/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/custom-baseUrl-more-options/code-model-v1.yaml b/test/Expected/custom-baseUrl-more-options/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/custom-baseUrl-more-options/code-model-v1.yaml rename to test/Expected/custom-baseUrl-more-options/code-model-v1.norm.yaml diff --git a/test/Expected/custom-baseUrl/code-model-v1-yaml.yaml b/test/Expected/custom-baseUrl/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/custom-baseUrl/code-model-v1-yaml.yaml rename to test/Expected/custom-baseUrl/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/custom-baseUrl/code-model-v1.yaml b/test/Expected/custom-baseUrl/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/custom-baseUrl/code-model-v1.yaml rename to test/Expected/custom-baseUrl/code-model-v1.norm.yaml diff --git a/test/Expected/extensible-enums-swagger/code-model-v1-yaml.yaml b/test/Expected/extensible-enums-swagger/code-model-v1-yaml.norm.yaml similarity index 98% rename from test/Expected/extensible-enums-swagger/code-model-v1-yaml.yaml rename to test/Expected/extensible-enums-swagger/code-model-v1-yaml.norm.yaml index 9740db1..7f60a46 100644 --- a/test/Expected/extensible-enums-swagger/code-model-v1-yaml.yaml +++ b/test/Expected/extensible-enums-swagger/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: '2016-07-07' -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: PetStore enumTypes: - &ref_0 @@ -37,7 +37,7 @@ enumTypes: $type: EnumType deprecated: false modelAsExtensible: true - modelAsString: false + modelAsString: true name: fixed: false raw: IntEnum @@ -131,6 +131,7 @@ modelTypes: extensions: x-ms-enum: modelAsExtensible: true + modelAsString: true name: IntEnum values: - allowedValues: diff --git a/test/Expected/extensible-enums-swagger/code-model-v1.yaml b/test/Expected/extensible-enums-swagger/code-model-v1.norm.yaml similarity index 98% rename from test/Expected/extensible-enums-swagger/code-model-v1.yaml rename to test/Expected/extensible-enums-swagger/code-model-v1.norm.yaml index ae9b06d..614a6ad 100644 --- a/test/Expected/extensible-enums-swagger/code-model-v1.yaml +++ b/test/Expected/extensible-enums-swagger/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: '2016-07-07' -baseUrl: 'https://localhost' +baseUrl: 'http://localhost:3000' documentation: PetStore enumTypes: - $ref: '5' @@ -103,6 +103,7 @@ modelTypes: extensions: x-ms-enum: modelAsExtensible: true + modelAsString: true name: IntEnum values: - allowedValues: @@ -132,7 +133,7 @@ modelTypes: $type: EnumType deprecated: false modelAsExtensible: true - modelAsString: false + modelAsString: true name: fixed: false raw: IntEnum diff --git a/test/Expected/head-exceptions/code-model-v1.yaml b/test/Expected/head-exceptions/code-model-v1-yaml.norm.yaml similarity index 98% rename from test/Expected/head-exceptions/code-model-v1.yaml rename to test/Expected/head-exceptions/code-model-v1-yaml.norm.yaml index 139ea5b..1efdfcf 100644 --- a/test/Expected/head-exceptions/code-model-v1.yaml +++ b/test/Expected/head-exceptions/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest modelsName: Models name: AutoRestHeadExceptionTestService diff --git a/test/Expected/head-exceptions/code-model-v1-yaml.yaml b/test/Expected/head-exceptions/code-model-v1.norm.yaml similarity index 98% rename from test/Expected/head-exceptions/code-model-v1-yaml.yaml rename to test/Expected/head-exceptions/code-model-v1.norm.yaml index 139ea5b..1efdfcf 100644 --- a/test/Expected/head-exceptions/code-model-v1-yaml.yaml +++ b/test/Expected/head-exceptions/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest modelsName: Models name: AutoRestHeadExceptionTestService diff --git a/test/Expected/head/code-model-v1.yaml b/test/Expected/head/code-model-v1-yaml.norm.yaml similarity index 98% rename from test/Expected/head/code-model-v1.yaml rename to test/Expected/head/code-model-v1-yaml.norm.yaml index bd23c90..f370fcb 100644 --- a/test/Expected/head/code-model-v1.yaml +++ b/test/Expected/head/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest modelsName: Models name: AutoRestHeadTestService diff --git a/test/Expected/head/code-model-v1-yaml.yaml b/test/Expected/head/code-model-v1.norm.yaml similarity index 98% rename from test/Expected/head/code-model-v1-yaml.yaml rename to test/Expected/head/code-model-v1.norm.yaml index bd23c90..f370fcb 100644 --- a/test/Expected/head/code-model-v1-yaml.yaml +++ b/test/Expected/head/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest modelsName: Models name: AutoRestHeadTestService diff --git a/test/Expected/header/code-model-v1-yaml.yaml b/test/Expected/header/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/header/code-model-v1-yaml.yaml rename to test/Expected/header/code-model-v1-yaml.norm.yaml index 486481a..b8ff77b 100644 --- a/test/Expected/header/code-model-v1-yaml.yaml +++ b/test/Expected/header/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - &ref_0 diff --git a/test/Expected/header/code-model-v1.yaml b/test/Expected/header/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/header/code-model-v1.yaml rename to test/Expected/header/code-model-v1.norm.yaml index b8716e9..701ca6c 100644 --- a/test/Expected/header/code-model-v1.yaml +++ b/test/Expected/header/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - $ref: '47' diff --git a/test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.yaml b/test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.yaml rename to test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.norm.yaml index fb99020..4325619 100644 --- a/test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.yaml +++ b/test/Expected/httpInfrastructure.quirks/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -62,8 +62,7 @@ errorTypes: containsConstantProperties: false deprecated: false extensions: - x-ms-client-name: - name: MyException + x-ms-client-name: MyException name: fixed: false raw: A diff --git a/test/Expected/httpInfrastructure.quirks/code-model-v1.yaml b/test/Expected/httpInfrastructure.quirks/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/httpInfrastructure.quirks/code-model-v1.yaml rename to test/Expected/httpInfrastructure.quirks/code-model-v1.norm.yaml index 13ab69d..43697c9 100644 --- a/test/Expected/httpInfrastructure.quirks/code-model-v1.yaml +++ b/test/Expected/httpInfrastructure.quirks/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -775,8 +775,7 @@ modelTypes: containsConstantProperties: false deprecated: false extensions: - x-ms-client-name: - name: MyException + x-ms-client-name: MyException name: fixed: false raw: A diff --git a/test/Expected/httpInfrastructure/code-model-v1-yaml.yaml b/test/Expected/httpInfrastructure/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/httpInfrastructure/code-model-v1-yaml.yaml rename to test/Expected/httpInfrastructure/code-model-v1-yaml.norm.yaml index fb99020..4325619 100644 --- a/test/Expected/httpInfrastructure/code-model-v1-yaml.yaml +++ b/test/Expected/httpInfrastructure/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -62,8 +62,7 @@ errorTypes: containsConstantProperties: false deprecated: false extensions: - x-ms-client-name: - name: MyException + x-ms-client-name: MyException name: fixed: false raw: A diff --git a/test/Expected/httpInfrastructure/code-model-v1.yaml b/test/Expected/httpInfrastructure/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/httpInfrastructure/code-model-v1.yaml rename to test/Expected/httpInfrastructure/code-model-v1.norm.yaml index 13ab69d..43697c9 100644 --- a/test/Expected/httpInfrastructure/code-model-v1.yaml +++ b/test/Expected/httpInfrastructure/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -775,8 +775,7 @@ modelTypes: containsConstantProperties: false deprecated: false extensions: - x-ms-client-name: - name: MyException + x-ms-client-name: MyException name: fixed: false raw: A diff --git a/test/Expected/lro/code-model-v1-yaml.yaml b/test/Expected/lro/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/lro/code-model-v1-yaml.yaml rename to test/Expected/lro/code-model-v1-yaml.norm.yaml index 8256cec..fc7b215 100644 --- a/test/Expected/lro/code-model-v1-yaml.yaml +++ b/test/Expected/lro/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Long-running Operation for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/lro/code-model-v1.yaml b/test/Expected/lro/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/lro/code-model-v1.yaml rename to test/Expected/lro/code-model-v1.norm.yaml index b9325f8..2b28d11 100644 --- a/test/Expected/lro/code-model-v1.yaml +++ b/test/Expected/lro/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Long-running Operation for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/model-flattening/code-model-v1-yaml.yaml b/test/Expected/model-flattening/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/model-flattening/code-model-v1-yaml.yaml rename to test/Expected/model-flattening/code-model-v1-yaml.norm.yaml index 005e4a9..4b7ac43 100644 --- a/test/Expected/model-flattening/code-model-v1-yaml.yaml +++ b/test/Expected/model-flattening/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/model-flattening/code-model-v1.yaml b/test/Expected/model-flattening/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/model-flattening/code-model-v1.yaml rename to test/Expected/model-flattening/code-model-v1.norm.yaml index eba8d2d..ec49ad3 100644 --- a/test/Expected/model-flattening/code-model-v1.yaml +++ b/test/Expected/model-flattening/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Resource Flattening for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/paging/code-model-v1-yaml.yaml b/test/Expected/paging/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/paging/code-model-v1-yaml.yaml rename to test/Expected/paging/code-model-v1-yaml.norm.yaml index 5b60e28..a6e40cc 100644 --- a/test/Expected/paging/code-model-v1-yaml.yaml +++ b/test/Expected/paging/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Long-running Operation for AutoRest modelTypes: - &ref_0 diff --git a/test/Expected/paging/code-model-v1.yaml b/test/Expected/paging/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/paging/code-model-v1.yaml rename to test/Expected/paging/code-model-v1.norm.yaml index cbbe992..5728887 100644 --- a/test/Expected/paging/code-model-v1.yaml +++ b/test/Expected/paging/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Long-running Operation for AutoRest modelTypes: - $id: '1' diff --git a/test/Expected/parameter-flattening/code-model-v1-yaml.yaml b/test/Expected/parameter-flattening/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/parameter-flattening/code-model-v1-yaml.yaml rename to test/Expected/parameter-flattening/code-model-v1-yaml.norm.yaml index c5ea8a3..e86d53e 100644 --- a/test/Expected/parameter-flattening/code-model-v1-yaml.yaml +++ b/test/Expected/parameter-flattening/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' codeGenExtensions: ft: '2' documentation: Resource Flattening for AutoRest diff --git a/test/Expected/parameter-flattening/code-model-v1.yaml b/test/Expected/parameter-flattening/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/parameter-flattening/code-model-v1.yaml rename to test/Expected/parameter-flattening/code-model-v1.norm.yaml index 9b9b7da..945299d 100644 --- a/test/Expected/parameter-flattening/code-model-v1.yaml +++ b/test/Expected/parameter-flattening/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' codeGenExtensions: ft: '2' documentation: Resource Flattening for AutoRest diff --git a/test/Expected/report/code-model-v1-yaml.yaml b/test/Expected/report/code-model-v1-yaml.norm.yaml similarity index 74% rename from test/Expected/report/code-model-v1-yaml.yaml rename to test/Expected/report/code-model-v1-yaml.norm.yaml index 41462ef..36e6c09 100644 --- a/test/Expected/report/code-model-v1-yaml.yaml +++ b/test/Expected/report/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 @@ -78,6 +78,32 @@ operations: name: fixed: false raw: getReport + parameters: + - collectionFormat: none + defaultValue: + fixed: false + deprecated: false + documentation: + fixed: false + raw: >- + If specified, qualifies the generated report further (e.g. '2.7' + vs '3.5' in for Python). The only effect is, that generators + that run all tests several times, can distinguish the generated + reports. + isConstant: false + isRequired: false + location: query + modelType: + $type: PrimaryType + deprecated: false + knownPrimaryType: string + name: + fixed: false + raw: String + name: + fixed: false + raw: qualifier + serializedName: qualifier requestContentType: application/json; charset=utf-8 responseContentTypes: - application/json diff --git a/test/Expected/report/code-model-v1.yaml b/test/Expected/report/code-model-v1.norm.yaml similarity index 72% rename from test/Expected/report/code-model-v1.yaml rename to test/Expected/report/code-model-v1.norm.yaml index 97a5bf8..085802f 100644 --- a/test/Expected/report/code-model-v1.yaml +++ b/test/Expected/report/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' @@ -83,20 +83,48 @@ operations: name: fixed: false raw: getReport + parameters: + - $id: '6' + collectionFormat: none + defaultValue: + fixed: false + deprecated: false + documentation: + fixed: false + raw: >- + If specified, qualifies the generated report further (e.g. '2.7' + vs '3.5' in for Python). The only effect is, that generators + that run all tests several times, can distinguish the generated + reports. + isConstant: false + isRequired: false + location: query + modelType: + $id: '7' + $type: PrimaryType + deprecated: false + knownPrimaryType: string + name: + fixed: false + raw: String + name: + fixed: false + raw: qualifier + serializedName: qualifier requestContentType: application/json; charset=utf-8 responseContentTypes: - application/json responses: OK: body: - $id: '6' + $id: '8' $type: DictionaryType deprecated: false name: fixed: false supportsAdditionalProperties: false valueType: - $id: '7' + $id: '9' $type: PrimaryType deprecated: false knownPrimaryType: int @@ -106,7 +134,7 @@ operations: isNullable: true returnType: body: - $ref: '6' + $ref: '8' isNullable: true serializedName: getReport url: /report diff --git a/test/Expected/required-optional/code-model-v1-yaml.yaml b/test/Expected/required-optional/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/required-optional/code-model-v1-yaml.yaml rename to test/Expected/required-optional/code-model-v1-yaml.norm.yaml index 6a3807b..9c3dc8c 100644 --- a/test/Expected/required-optional/code-model-v1-yaml.yaml +++ b/test/Expected/required-optional/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/required-optional/code-model-v1.yaml b/test/Expected/required-optional/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/required-optional/code-model-v1.yaml rename to test/Expected/required-optional/code-model-v1.norm.yaml index c344a94..0a22d51 100644 --- a/test/Expected/required-optional/code-model-v1.yaml +++ b/test/Expected/required-optional/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/specs-batch/code-model-v1-yaml.yaml b/test/Expected/specs-batch/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-batch/code-model-v1-yaml.yaml rename to test/Expected/specs-batch/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-batch/code-model-v1.yaml b/test/Expected/specs-batch/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-batch/code-model-v1.yaml rename to test/Expected/specs-batch/code-model-v1.norm.yaml diff --git a/test/Expected/specs-compute/code-model-v1-yaml.yaml b/test/Expected/specs-compute/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-compute/code-model-v1-yaml.yaml rename to test/Expected/specs-compute/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-compute/code-model-v1.yaml b/test/Expected/specs-compute/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-compute/code-model-v1.yaml rename to test/Expected/specs-compute/code-model-v1.norm.yaml diff --git a/test/Expected/specs-datalake-store/code-model-v1-yaml.yaml b/test/Expected/specs-datalake-store/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-datalake-store/code-model-v1-yaml.yaml rename to test/Expected/specs-datalake-store/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-datalake-store/code-model-v1.yaml b/test/Expected/specs-datalake-store/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-datalake-store/code-model-v1.yaml rename to test/Expected/specs-datalake-store/code-model-v1.norm.yaml diff --git a/test/Expected/specs-mobileengagement/code-model-v1-yaml.yaml b/test/Expected/specs-mobileengagement/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-mobileengagement/code-model-v1-yaml.yaml rename to test/Expected/specs-mobileengagement/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-mobileengagement/code-model-v1.yaml b/test/Expected/specs-mobileengagement/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-mobileengagement/code-model-v1.yaml rename to test/Expected/specs-mobileengagement/code-model-v1.norm.yaml diff --git a/test/Expected/specs-network/code-model-v1-yaml.yaml b/test/Expected/specs-network/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-network/code-model-v1-yaml.yaml rename to test/Expected/specs-network/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-network/code-model-v1.yaml b/test/Expected/specs-network/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-network/code-model-v1.yaml rename to test/Expected/specs-network/code-model-v1.norm.yaml diff --git a/test/Expected/specs-search/code-model-v1-yaml.yaml b/test/Expected/specs-search/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-search/code-model-v1-yaml.yaml rename to test/Expected/specs-search/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-search/code-model-v1.yaml b/test/Expected/specs-search/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-search/code-model-v1.yaml rename to test/Expected/specs-search/code-model-v1.norm.yaml diff --git a/test/Expected/specs-web/code-model-v1-yaml.yaml b/test/Expected/specs-web/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/specs-web/code-model-v1-yaml.yaml rename to test/Expected/specs-web/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/specs-web/code-model-v1.yaml b/test/Expected/specs-web/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/specs-web/code-model-v1.yaml rename to test/Expected/specs-web/code-model-v1.norm.yaml diff --git a/test/Expected/storage/code-model-v1-yaml.yaml b/test/Expected/storage/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/storage/code-model-v1-yaml.yaml rename to test/Expected/storage/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/storage/code-model-v1.yaml b/test/Expected/storage/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/storage/code-model-v1.yaml rename to test/Expected/storage/code-model-v1.norm.yaml diff --git a/test/Expected/subscriptionId-apiVersion/code-model-v1-yaml.yaml b/test/Expected/subscriptionId-apiVersion/code-model-v1-yaml.norm.yaml similarity index 100% rename from test/Expected/subscriptionId-apiVersion/code-model-v1-yaml.yaml rename to test/Expected/subscriptionId-apiVersion/code-model-v1-yaml.norm.yaml diff --git a/test/Expected/subscriptionId-apiVersion/code-model-v1.yaml b/test/Expected/subscriptionId-apiVersion/code-model-v1.norm.yaml similarity index 100% rename from test/Expected/subscriptionId-apiVersion/code-model-v1.yaml rename to test/Expected/subscriptionId-apiVersion/code-model-v1.norm.yaml diff --git a/test/Expected/url-multi-collectionFormat/code-model-v1-yaml.yaml b/test/Expected/url-multi-collectionFormat/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/url-multi-collectionFormat/code-model-v1-yaml.yaml rename to test/Expected/url-multi-collectionFormat/code-model-v1-yaml.norm.yaml index 55d3249..3dea4de 100644 --- a/test/Expected/url-multi-collectionFormat/code-model-v1-yaml.yaml +++ b/test/Expected/url-multi-collectionFormat/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - &ref_0 diff --git a/test/Expected/url-multi-collectionFormat/code-model-v1.yaml b/test/Expected/url-multi-collectionFormat/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/url-multi-collectionFormat/code-model-v1.yaml rename to test/Expected/url-multi-collectionFormat/code-model-v1.norm.yaml index 2375cd2..1f86153 100644 --- a/test/Expected/url-multi-collectionFormat/code-model-v1.yaml +++ b/test/Expected/url-multi-collectionFormat/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest errorTypes: - $ref: '1' diff --git a/test/Expected/url/code-model-v1-yaml.yaml b/test/Expected/url/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/url/code-model-v1-yaml.yaml rename to test/Expected/url/code-model-v1-yaml.norm.yaml index c105390..2c9e4e3 100644 --- a/test/Expected/url/code-model-v1-yaml.yaml +++ b/test/Expected/url/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - &ref_1 diff --git a/test/Expected/url/code-model-v1.yaml b/test/Expected/url/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/url/code-model-v1.yaml rename to test/Expected/url/code-model-v1.norm.yaml index 80da460..1aac3cf 100644 --- a/test/Expected/url/code-model-v1.yaml +++ b/test/Expected/url/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest enumTypes: - $id: '6' diff --git a/test/Expected/validation/code-model-v1-yaml.yaml b/test/Expected/validation/code-model-v1-yaml.norm.yaml similarity index 99% rename from test/Expected/validation/code-model-v1-yaml.yaml rename to test/Expected/validation/code-model-v1-yaml.norm.yaml index 23a7f8a..d8a87e6 100644 --- a/test/Expected/validation/code-model-v1-yaml.yaml +++ b/test/Expected/validation/code-model-v1-yaml.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest. No server backend exists for these tests. enumTypes: - &ref_2 diff --git a/test/Expected/validation/code-model-v1.yaml b/test/Expected/validation/code-model-v1.norm.yaml similarity index 99% rename from test/Expected/validation/code-model-v1.yaml rename to test/Expected/validation/code-model-v1.norm.yaml index 2d5dc36..85e95c2 100644 --- a/test/Expected/validation/code-model-v1.yaml +++ b/test/Expected/validation/code-model-v1.norm.yaml @@ -1,6 +1,6 @@ --- apiVersion: 1.0.0 -baseUrl: 'http://localhost' +baseUrl: 'http://localhost:3000' documentation: Test Infrastructure for AutoRest. No server backend exists for these tests. enumTypes: - $ref: '26' diff --git a/test/SwaggerModelerTests.cs b/test/SwaggerModelerTests.cs index 9fcc222..37a81e7 100644 --- a/test/SwaggerModelerTests.cs +++ b/test/SwaggerModelerTests.cs @@ -70,23 +70,24 @@ namespace AutoRest.Modeler.Tests Assert.Equal("https://management.azure.com", codeModel.BaseUrl); Assert.Equal("Some cool documentation.", codeModel.Documentation); //var allMethods = codeModel.Operations.SelectMany(each => each.Methods); - Assert.Equal(2, codeModel.Methods.Count); - Assert.Equal("List", codeModel.Methods[0].Name); - Assert.NotEmpty(codeModel.Methods[0].Description); - Assert.Equal(description, codeModel.Methods[0].Description); - Assert.NotEmpty(codeModel.Methods[0].Summary); - Assert.Equal(summary, codeModel.Methods[0].Summary); - Assert.Equal(HttpMethod.Get, codeModel.Methods[0].HttpMethod); - Assert.Equal(3, codeModel.Methods[0].Parameters.Count); - Assert.Equal("subscriptionId", codeModel.Methods[0].Parameters[0].Name); - Assert.NotNull(codeModel.Methods[0].Parameters[0].ClientProperty); - Assert.Equal("resourceGroupName", codeModel.Methods[0].Parameters[1].Name); - Assert.Equal("resourceGroupName", codeModel.Methods[0].Parameters[1].SerializedName); - Assert.Equal("Resource Group ID.", codeModel.Methods[0].Parameters[1].Documentation); - Assert.Equal(true, codeModel.Methods[0].Parameters[0].IsRequired); - Assert.Equal(ParameterLocation.Path, codeModel.Methods[0].Parameters[0].Location); - Assert.Equal("String", codeModel.Methods[0].Parameters[0].ModelType.Name); - Assert.Equal("Reset", codeModel.Methods[1].Name); + var methods = codeModel.Methods.ToList(); + Assert.Equal(2, methods.Count); + Assert.Equal("List", methods[0].Name); + Assert.NotEmpty(methods[0].Description); + Assert.Equal(description, methods[0].Description); + Assert.NotEmpty(methods[0].Summary); + Assert.Equal(summary, methods[0].Summary); + Assert.Equal(HttpMethod.Get, methods[0].HttpMethod); + Assert.Equal(3, methods[0].Parameters.Count); + Assert.Equal("subscriptionId", methods[0].Parameters[0].Name); + Assert.NotNull(methods[0].Parameters[0].ClientProperty); + Assert.Equal("resourceGroupName", methods[0].Parameters[1].Name); + Assert.Equal("resourceGroupName", methods[0].Parameters[1].SerializedName); + Assert.Equal("Resource Group ID.", methods[0].Parameters[1].Documentation); + Assert.Equal(true, methods[0].Parameters[0].IsRequired); + Assert.Equal(ParameterLocation.Path, methods[0].Parameters[0].Location); + Assert.Equal("String", methods[0].Parameters[0].ModelType.Name); + Assert.Equal("Reset", methods[1].Name); Assert.Equal("Product", codeModel.ModelTypes.First(m => m.Name == "Product").Name); Assert.Equal("Product", codeModel.ModelTypes.First(m => m.Name == "Product").SerializedName); Assert.Equal("The product title.", codeModel.ModelTypes.First(m => m.Name == "Product").Summary); @@ -97,13 +98,13 @@ namespace AutoRest.Modeler.Tests Assert.Equal("ProductId", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[0].Name); Assert.Equal("product_id", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[0].SerializedName); - Assert.Null(codeModel.Methods[1].ReturnType.Body); - Assert.Null(codeModel.Methods[1].Responses[HttpStatusCode.NoContent].Body); - Assert.Equal(3, codeModel.Methods[1].Parameters.Count); - Assert.Equal("subscriptionId", codeModel.Methods[1].Parameters[0].Name); - Assert.Null(codeModel.Methods[1].Parameters[0].ClientProperty); - Assert.Equal("resourceGroupName", codeModel.Methods[1].Parameters[1].Name); - Assert.Equal("apiVersion", codeModel.Methods[1].Parameters[2].Name); + Assert.Null(methods[1].ReturnType.Body); + Assert.Null(methods[1].Responses[HttpStatusCode.NoContent].Body); + Assert.Equal(3, methods[1].Parameters.Count); + Assert.Equal("subscriptionId", methods[1].Parameters[0].Name); + Assert.Null(methods[1].Parameters[0].ClientProperty); + Assert.Equal("resourceGroupName", methods[1].Parameters[1].Name); + Assert.Equal("apiVersion", methods[1].Parameters[2].Name); Assert.Equal("Capacity", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[3].Name); Assert.Equal("100", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[3].DefaultValue); @@ -231,10 +232,11 @@ namespace AutoRest.Modeler.Tests var modeler = new SwaggerModeler(); var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); - Assert.Equal("DeleteBlob", codeModel.Methods[4].Name); - Assert.True(codeModel.Methods[4].ReturnType.Body.IsPrimaryType(KnownPrimaryType.Object)); - Assert.True(codeModel.Methods[4].Responses[HttpStatusCode.OK].Body.IsPrimaryType(KnownPrimaryType.Object)); - Assert.Null(codeModel.Methods[4].Responses[HttpStatusCode.BadRequest].Body); + var methods = codeModel.Methods.ToList(); + Assert.Equal("DeleteBlob", methods[4].Name); + Assert.True(methods[4].ReturnType.Body.IsPrimaryType(KnownPrimaryType.Object)); + Assert.True(methods[4].Responses[HttpStatusCode.OK].Body.IsPrimaryType(KnownPrimaryType.Object)); + Assert.Null(methods[4].Responses[HttpStatusCode.BadRequest].Body); } [Fact] @@ -245,20 +247,21 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal("GetSameResponse", codeModel.Methods[0].Name); - Assert.Equal("IList", CreateCSharpResponseType(codeModel.Methods[0].ReturnType)); - Assert.Equal("IList", CreateCSharpResponseType(codeModel.Methods[0].Responses[HttpStatusCode.OK])); - Assert.Equal("IList", CreateCSharpResponseType(codeModel.Methods[0].Responses[HttpStatusCode.Accepted])); + var methods = codeModel.Methods.ToList(); + Assert.Equal("GetSameResponse", methods[0].Name); + Assert.Equal("IList", CreateCSharpResponseType(methods[0].ReturnType)); + Assert.Equal("IList", CreateCSharpResponseType(methods[0].Responses[HttpStatusCode.OK])); + Assert.Equal("IList", CreateCSharpResponseType(methods[0].Responses[HttpStatusCode.Accepted])); - Assert.Equal("PostInheretedTypes", codeModel.Methods[1].Name); - Assert.Equal("Pet", CreateCSharpResponseType(codeModel.Methods[1].ReturnType)); - Assert.Equal("Dog", CreateCSharpResponseType(codeModel.Methods[1].Responses[HttpStatusCode.OK])); - Assert.Equal("Cat", CreateCSharpResponseType(codeModel.Methods[1].Responses[HttpStatusCode.Accepted])); + Assert.Equal("PostInheretedTypes", methods[1].Name); + Assert.Equal("Pet", CreateCSharpResponseType(methods[1].ReturnType)); + Assert.Equal("Dog", CreateCSharpResponseType(methods[1].Responses[HttpStatusCode.OK])); + Assert.Equal("Cat", CreateCSharpResponseType(methods[1].Responses[HttpStatusCode.Accepted])); - Assert.Equal("PatchDifferentStreamTypesNoContent", codeModel.Methods[6].Name); - Assert.Equal("VirtualMachineGetRemoteDesktopFileResponse", CreateCSharpResponseType(codeModel.Methods[6].ReturnType)); - Assert.Equal("VirtualMachineGetRemoteDesktopFileResponse", CreateCSharpResponseType(codeModel.Methods[6].Responses[HttpStatusCode.OK])); - Assert.Null(codeModel.Methods[6].Responses[HttpStatusCode.NoContent].Body); + Assert.Equal("PatchDifferentStreamTypesNoContent", methods[6].Name); + Assert.Equal("VirtualMachineGetRemoteDesktopFileResponse", CreateCSharpResponseType(methods[6].ReturnType)); + Assert.Equal("VirtualMachineGetRemoteDesktopFileResponse", CreateCSharpResponseType(methods[6].Responses[HttpStatusCode.OK])); + Assert.Null(methods[6].Responses[HttpStatusCode.NoContent].Body); } [Fact] @@ -280,8 +283,9 @@ namespace AutoRest.Modeler.Tests var modeler = new SwaggerModeler(); var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); - Assert.Equal(1, codeModel.Methods[0].Responses.Count); - Assert.NotNull(codeModel.Methods[0].Responses[HttpStatusCode.OK]); + var methods = codeModel.Methods.ToList(); + Assert.Equal(1, methods[0].Responses.Count); + Assert.NotNull(methods[0].Responses[HttpStatusCode.OK]); } [Fact] @@ -292,23 +296,24 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal("GetWithStreamFormData", codeModel.Methods[0].Name); - Assert.Equal("Stream", codeModel.Methods[0].Parameters[0].ModelType.Name); - Assert.Equal("Stream", CreateCSharpResponseType(codeModel.Methods[0].ReturnType)); - Assert.Equal("Stream", CreateCSharpResponseType(codeModel.Methods[0].Responses[HttpStatusCode.OK])); + var methods = codeModel.Methods.ToList(); + Assert.Equal("GetWithStreamFormData", methods[0].Name); + Assert.Equal("Stream", methods[0].Parameters[0].ModelType.Name); + Assert.Equal("Stream", CreateCSharpResponseType(methods[0].ReturnType)); + Assert.Equal("Stream", CreateCSharpResponseType(methods[0].Responses[HttpStatusCode.OK])); - Assert.Equal("PostWithByteArrayFormData", codeModel.Methods[1].Name); - Assert.Equal("ByteArray", codeModel.Methods[1].Parameters[0].ModelType.Name); - Assert.Equal("ByteArray", CreateCSharpResponseType(codeModel.Methods[1].ReturnType)); - Assert.Equal("ByteArray", CreateCSharpResponseType(codeModel.Methods[1].Responses[HttpStatusCode.OK])); + Assert.Equal("PostWithByteArrayFormData", methods[1].Name); + Assert.Equal("ByteArray", methods[1].Parameters[0].ModelType.Name); + Assert.Equal("ByteArray", CreateCSharpResponseType(methods[1].ReturnType)); + Assert.Equal("ByteArray", CreateCSharpResponseType(methods[1].Responses[HttpStatusCode.OK])); - Assert.Equal("GetWithStream", codeModel.Methods[2].Name); - Assert.Equal("Stream", CreateCSharpResponseType(codeModel.Methods[2].ReturnType)); - Assert.Equal("Stream", CreateCSharpResponseType(codeModel.Methods[2].Responses[HttpStatusCode.OK])); + Assert.Equal("GetWithStream", methods[2].Name); + Assert.Equal("Stream", CreateCSharpResponseType(methods[2].ReturnType)); + Assert.Equal("Stream", CreateCSharpResponseType(methods[2].Responses[HttpStatusCode.OK])); - Assert.Equal("PostWithByteArray", codeModel.Methods[3].Name); - Assert.Equal("ByteArray", CreateCSharpResponseType(codeModel.Methods[3].ReturnType)); - Assert.Equal("ByteArray", CreateCSharpResponseType(codeModel.Methods[3].Responses[HttpStatusCode.OK])); + Assert.Equal("PostWithByteArray", methods[3].Name); + Assert.Equal("ByteArray", CreateCSharpResponseType(methods[3].ReturnType)); + Assert.Equal("ByteArray", CreateCSharpResponseType(methods[3].Responses[HttpStatusCode.OK])); } [Fact] @@ -319,9 +324,10 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal(0, codeModel.Methods.Count(m => m.Group == null)); - Assert.Equal(2, codeModel.Methods.Count(m => m.Group == "Widgets")); - Assert.Equal("List", codeModel.Methods[0].Name); + var methods = codeModel.Methods.ToList(); + Assert.Equal(0, methods.Count(m => m.Group == null)); + Assert.Equal(2, methods.Count(m => m.Group == "Widgets")); + Assert.Equal("List", methods[0].Name); } [Fact] @@ -332,21 +338,22 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal("Int integer", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[0])); - Assert.Equal("Int int", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[1])); - Assert.Equal("Long long", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[2])); - Assert.Equal("Double number", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[3])); - Assert.Equal("Double float", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[4])); - Assert.Equal("Double double", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[5])); - Assert.Equal("Decimal decimal", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[6])); - Assert.Equal("String string", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[7])); - Assert.Equal("enum color", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[8])); - Assert.Equal("ByteArray byte", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[9])); - Assert.Equal("Boolean boolean", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[10])); - Assert.Equal("Date date", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[11])); - Assert.Equal("DateTime dateTime", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[12])); - Assert.Equal("Base64Url base64url", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[13])); - Assert.Equal("IList array", CreateCSharpDeclarationString(codeModel.Methods[0].Parameters[14])); + var methods = codeModel.Methods.ToList(); + Assert.Equal("Int integer", CreateCSharpDeclarationString(methods[0].Parameters[0])); + Assert.Equal("Int int", CreateCSharpDeclarationString(methods[0].Parameters[1])); + Assert.Equal("Long long", CreateCSharpDeclarationString(methods[0].Parameters[2])); + Assert.Equal("Double number", CreateCSharpDeclarationString(methods[0].Parameters[3])); + Assert.Equal("Double float", CreateCSharpDeclarationString(methods[0].Parameters[4])); + Assert.Equal("Double double", CreateCSharpDeclarationString(methods[0].Parameters[5])); + Assert.Equal("Decimal decimal", CreateCSharpDeclarationString(methods[0].Parameters[6])); + Assert.Equal("String string", CreateCSharpDeclarationString(methods[0].Parameters[7])); + Assert.Equal("enum color", CreateCSharpDeclarationString(methods[0].Parameters[8])); + Assert.Equal("ByteArray byte", CreateCSharpDeclarationString(methods[0].Parameters[9])); + Assert.Equal("Boolean boolean", CreateCSharpDeclarationString(methods[0].Parameters[10])); + Assert.Equal("Date date", CreateCSharpDeclarationString(methods[0].Parameters[11])); + Assert.Equal("DateTime dateTime", CreateCSharpDeclarationString(methods[0].Parameters[12])); + Assert.Equal("Base64Url base64url", CreateCSharpDeclarationString(methods[0].Parameters[13])); + Assert.Equal("IList array", CreateCSharpDeclarationString(methods[0].Parameters[14])); var variableEnumInPath = codeModel.Methods.First(m => m.Name == "List" && m.Group.IsNullOrEmpty()) @@ -445,40 +452,41 @@ namespace AutoRest.Modeler.Tests var modeler = new SwaggerModeler(); var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); - Assert.Equal("resourceGroupName", codeModel.Methods[0].Parameters[1].Name); - Assert.Equal(true, codeModel.Methods[0].Parameters[1].IsRequired); - Assert.Equal(3, codeModel.Methods[0].Parameters[1].Constraints.Count); - Assert.Equal("10", codeModel.Methods[0].Parameters[1].Constraints[Constraint.MaxLength]); - Assert.Equal("3", codeModel.Methods[0].Parameters[1].Constraints[Constraint.MinLength]); - Assert.Equal("[a-zA-Z0-9]+", codeModel.Methods[0].Parameters[1].Constraints[Constraint.Pattern]); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MultipleOf)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.ExclusiveMaximum)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.ExclusiveMinimum)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.InclusiveMinimum)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.InclusiveMaximum)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MinItems)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MaxItems)); - Assert.False(codeModel.Methods[0].Parameters[1].Constraints.ContainsKey(Constraint.UniqueItems)); + var methods = codeModel.Methods.ToList(); + Assert.Equal("resourceGroupName", methods[0].Parameters[1].Name); + Assert.Equal(true, methods[0].Parameters[1].IsRequired); + Assert.Equal(3, methods[0].Parameters[1].Constraints.Count); + Assert.Equal("10", methods[0].Parameters[1].Constraints[Constraint.MaxLength]); + Assert.Equal("3", methods[0].Parameters[1].Constraints[Constraint.MinLength]); + Assert.Equal("[a-zA-Z0-9]+", methods[0].Parameters[1].Constraints[Constraint.Pattern]); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MultipleOf)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.ExclusiveMaximum)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.ExclusiveMinimum)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.InclusiveMinimum)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.InclusiveMaximum)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MinItems)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.MaxItems)); + Assert.False(methods[0].Parameters[1].Constraints.ContainsKey(Constraint.UniqueItems)); - Assert.Equal("id", codeModel.Methods[0].Parameters[2].Name); - Assert.Equal(3, codeModel.Methods[0].Parameters[2].Constraints.Count); - Assert.Equal("10", codeModel.Methods[0].Parameters[2].Constraints[Constraint.MultipleOf]); - Assert.Equal("100", codeModel.Methods[0].Parameters[2].Constraints[Constraint.InclusiveMinimum]); - Assert.Equal("1000", codeModel.Methods[0].Parameters[2].Constraints[Constraint.InclusiveMaximum]); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.ExclusiveMaximum)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.ExclusiveMinimum)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MaxLength)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MinLength)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.Pattern)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MinItems)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MaxItems)); - Assert.False(codeModel.Methods[0].Parameters[2].Constraints.ContainsKey(Constraint.UniqueItems)); + Assert.Equal("id", methods[0].Parameters[2].Name); + Assert.Equal(3, methods[0].Parameters[2].Constraints.Count); + Assert.Equal("10", methods[0].Parameters[2].Constraints[Constraint.MultipleOf]); + Assert.Equal("100", methods[0].Parameters[2].Constraints[Constraint.InclusiveMinimum]); + Assert.Equal("1000", methods[0].Parameters[2].Constraints[Constraint.InclusiveMaximum]); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.ExclusiveMaximum)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.ExclusiveMinimum)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MaxLength)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MinLength)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.Pattern)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MinItems)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.MaxItems)); + Assert.False(methods[0].Parameters[2].Constraints.ContainsKey(Constraint.UniqueItems)); - Assert.Equal("apiVersion", codeModel.Methods[0].Parameters[3].Name); - Assert.NotNull(codeModel.Methods[0].Parameters[3].ClientProperty); - Assert.Equal(1, codeModel.Methods[0].Parameters[3].Constraints.Count); - Assert.Equal("\\d{2}-\\d{2}-\\d{4}", codeModel.Methods[0].Parameters[3].Constraints[Constraint.Pattern]); + Assert.Equal("apiVersion", methods[0].Parameters[3].Name); + Assert.NotNull(methods[0].Parameters[3].ClientProperty); + Assert.Equal(1, methods[0].Parameters[3].Constraints.Count); + Assert.Equal("\\d{2}-\\d{2}-\\d{4}", methods[0].Parameters[3].Constraints[Constraint.Pattern]); Assert.Equal("Product", codeModel.ModelTypes.First(m => m.Name == "Product").Name); Assert.Equal("DisplayNames", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[2].Name); @@ -508,15 +516,16 @@ namespace AutoRest.Modeler.Tests var modeler = new SwaggerModeler(); var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); - Assert.Equal("myintconst", codeModel.Methods[0].Parameters[4].Name); - Assert.Equal(true, codeModel.Methods[0].Parameters[4].ModelType.IsPrimaryType(KnownPrimaryType.Int)); - Assert.Equal(true, codeModel.Methods[0].Parameters[4].IsConstant); - Assert.Equal("0", codeModel.Methods[0].Parameters[4].DefaultValue); + var methods = codeModel.Methods.ToList(); + Assert.Equal("myintconst", methods[0].Parameters[4].Name); + Assert.Equal(true, methods[0].Parameters[4].ModelType.IsPrimaryType(KnownPrimaryType.Int)); + Assert.Equal(true, methods[0].Parameters[4].IsConstant); + Assert.Equal("0", methods[0].Parameters[4].DefaultValue); - Assert.Equal("mystrconst", codeModel.Methods[0].Parameters[5].Name); - Assert.Equal(true, codeModel.Methods[0].Parameters[5].ModelType.IsPrimaryType(KnownPrimaryType.String)); - Assert.Equal(true, codeModel.Methods[0].Parameters[5].IsConstant); - Assert.Equal("constant", codeModel.Methods[0].Parameters[5].DefaultValue); + Assert.Equal("mystrconst", methods[0].Parameters[5].Name); + Assert.Equal(true, methods[0].Parameters[5].ModelType.IsPrimaryType(KnownPrimaryType.String)); + Assert.Equal(true, methods[0].Parameters[5].IsConstant); + Assert.Equal("constant", methods[0].Parameters[5].DefaultValue); Assert.Equal("Myintconst", codeModel.ModelTypes.First(m => m.Name == "Product").Properties[5].Name); Assert.Equal(true, codeModel.ModelTypes.First(m => m.Name == "Product").Properties[5].ModelType.IsPrimaryType(KnownPrimaryType.Int)); @@ -571,20 +580,21 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal(2, codeModel.Methods.Count); - Assert.Equal(2, codeModel.Methods[0].Responses.Count); - Assert.Equal("ListHeaders", codeModel.Methods[0].Responses[HttpStatusCode.OK].Headers.Name); - Assert.Equal(3, ((CompositeType)codeModel.Methods[0].Responses[HttpStatusCode.OK].Headers).Properties.Count); - Assert.Equal("ListHeaders", codeModel.Methods[0].Responses[HttpStatusCode.Created].Headers.Name); - Assert.Equal(3, ((CompositeType)codeModel.Methods[0].Responses[HttpStatusCode.Created].Headers).Properties.Count); - Assert.Equal("ListHeaders", codeModel.Methods[0].ReturnType.Headers.Name); - Assert.Equal(3, ((CompositeType)codeModel.Methods[0].ReturnType.Headers).Properties.Count); + var methods = codeModel.Methods.ToList(); + Assert.Equal(2, methods.Count); + Assert.Equal(2, methods[0].Responses.Count); + Assert.Equal("ListHeaders", methods[0].Responses[HttpStatusCode.OK].Headers.Name); + Assert.Equal(3, ((CompositeType)methods[0].Responses[HttpStatusCode.OK].Headers).Properties.Count); + Assert.Equal("ListHeaders", methods[0].Responses[HttpStatusCode.Created].Headers.Name); + Assert.Equal(3, ((CompositeType)methods[0].Responses[HttpStatusCode.Created].Headers).Properties.Count); + Assert.Equal("ListHeaders", methods[0].ReturnType.Headers.Name); + Assert.Equal(3, ((CompositeType)methods[0].ReturnType.Headers).Properties.Count); - Assert.Equal(1, codeModel.Methods[1].Responses.Count); - Assert.Equal("CreateHeaders", codeModel.Methods[1].Responses[HttpStatusCode.OK].Headers.Name); - Assert.Equal(3, ((CompositeType)codeModel.Methods[1].Responses[HttpStatusCode.OK].Headers).Properties.Count); - Assert.Equal("CreateHeaders", codeModel.Methods[1].ReturnType.Headers.Name); - Assert.Equal(3, ((CompositeType)codeModel.Methods[1].ReturnType.Headers).Properties.Count); + Assert.Equal(1, methods[1].Responses.Count); + Assert.Equal("CreateHeaders", methods[1].Responses[HttpStatusCode.OK].Headers.Name); + Assert.Equal(3, ((CompositeType)methods[1].Responses[HttpStatusCode.OK].Headers).Properties.Count); + Assert.Equal("CreateHeaders", methods[1].ReturnType.Headers.Name); + Assert.Equal(3, ((CompositeType)methods[1].ReturnType.Headers).Properties.Count); Assert.True(codeModel.HeaderTypes.Any(c => c.Name == "ListHeaders")); Assert.True(codeModel.HeaderTypes.Any(c => c.Name == "CreateHeaders")); } @@ -597,7 +607,7 @@ namespace AutoRest.Modeler.Tests var codeModel = modeler.Build(SwaggerParser.Parse(File.ReadAllText(input))); Assert.NotNull(codeModel); - Assert.Equal(3, codeModel.Methods.Count); + Assert.Equal(3, codeModel.Methods.Count()); Assert.True(codeModel.Methods.All(m => m.Url == "/values/foo")); } diff --git a/test/VendorExtensionInPath.cs b/test/VendorExtensionInPath.cs index dbe2967..b53a657 100644 --- a/test/VendorExtensionInPath.cs +++ b/test/VendorExtensionInPath.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using System.Linq; using System.IO; using AutoRest.Core; using Xunit; @@ -22,7 +23,7 @@ namespace AutoRest.Modeler.Tests Assert.NotNull(clientModel); // there should be one method in this generated api. - Assert.Equal(1, modeler.CodeModel.Methods.Count); + Assert.Equal(1, modeler.CodeModel.Methods.Count()); } } } \ No newline at end of file