Fix flattened model with nullable (#4324)

This commit is contained in:
Timothee Guerin 2021-10-15 09:30:35 -07:00 коммит произвёл GitHub
Родитель 55efe04ed6
Коммит dfe3d095b4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 30 добавлений и 16 удалений

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

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

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

@ -5,6 +5,7 @@
trigger:
- main
- release/*
pool:
vmImage: "ubuntu-latest"

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

@ -1,6 +1,21 @@
{
"name": "@autorest/modelerfour",
"entries": [
{
"version": "4.21.4",
"tag": "@autorest/modelerfour_v4.21.4",
"date": "Mon, 04 Oct 2021 18:15:27 GMT",
"comments": {
"patch": [
{
"comment": "**Fix** Flatten nullable property doesn't propagate."
},
{
"comment": "**Internal** remove use of string and array extension method `.last`."
}
]
}
},
{
"version": "4.21.3",
"tag": "@autorest/modelerfour_v4.21.3",

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

@ -1,6 +1,14 @@
# Change Log - @autorest/modelerfour
This log was last generated on Wed, 29 Sep 2021 15:39:07 GMT and should not be manually modified.
This log was last generated on Fri, 15 Oct 2021 15:41:45 GMT and should not be manually modified.
## 4.21.4
Mon, 04 Oct 2021 18:15:27 GMT
### Patches
- **Fix** Flatten nullable property doesn't propagate.
- **Internal** remove use of string and array extension method `.last`.
## 4.21.3
Wed, 29 Sep 2021 15:39:07 GMT

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

@ -1,6 +1,6 @@
{
"name": "@autorest/modelerfour",
"version": "4.21.3",
"version": "4.21.4",
"description": "AutoRest Modeler Version Four (component)",
"directories": {
"doc": "docs"

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

@ -29,8 +29,8 @@ export class Checker {
const duplicates = findDuplicates(group.operations, (x) => x.language.default.name);
for (const [dupe, operations] of Object.entries(duplicates)) {
const paths = operations
.map((x) => x.requests?.[0].protocol.http?.path)
.map((x) => ` - ${x}`)
.map((x) => x.requests?.[0].protocol.http)
.map((x) => ` - ${x?.method} ${x?.path}`)
.join("\n");
this.session.error(
`Duplicate Operation '${group.language.default.name}' > '${dupe}' detected(This is most likely due to 2 operation using the same 'operationId' or 'tags'). Duplicates have those paths:\n${paths}`,

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

@ -146,12 +146,13 @@ export class Flattener {
childProperty.language.default.description,
childProperty.schema,
{
...(<any>childProperty),
...childProperty,
flattenedNames: [
property.serializedName,
...(childProperty.flattenedNames ? childProperty.flattenedNames : [childProperty.serializedName]),
],
required: property.required && childProperty.required,
nullable: property.nullable ?? childProperty.nullable,
},
),
);