|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import { Schema as NewSchema, SchemaType, ArraySchema, SchemaResponse, HttpParameter, ObjectSchema, DictionarySchema } from '@azure-tools/codemodel'; |
| 6 | +import { Schema as NewSchema, SchemaType, ArraySchema, SchemaResponse, HttpParameter, ObjectSchema, DictionarySchema, ChoiceSchema, SealedChoiceSchema } from '@azure-tools/codemodel'; |
7 | 7 | import { command, getAllProperties, JsonType, http, getAllPublicVirtualProperties, getVirtualPropertyFromPropertyName, ParameterLocation, getAllVirtualProperties, VirtualParameter, VirtualProperty } from '@azure-tools/codemodel-v3'; |
8 | 8 | import { CommandOperation, VirtualParameter as NewVirtualParameter } from '../utils/command-operation'; |
9 | 9 | import { getAllProperties as NewGetAllProperties, getAllPublicVirtualProperties as NewGetAllPublicVirtualProperties, getVirtualPropertyFromPropertyName as NewGetVirtualPropertyFromPropertyName, VirtualProperty as NewVirtualProperty } from '../utils/schema'; |
@@ -2665,7 +2665,9 @@ export class NewCmdletClass extends Class { |
2665 | 2665 | const resultSchema = length(props) !== 1 ? <NewSchema>schema : <NewSchema>props[0].schema; |
2666 | 2666 |
|
2667 | 2667 | // make sure return type for boolean stays boolean! |
2668 | | - if (resultSchema.type === SchemaType.Boolean) { |
| 2668 | + if (resultSchema.type === SchemaType.Boolean || |
| 2669 | + (resultSchema.type === SchemaType.Choice && (<any>resultSchema).choiceType.type === SchemaType.Boolean && (<ChoiceSchema>resultSchema).choices.length === 1) || |
| 2670 | + (resultSchema.type === SchemaType.SealedChoice && (<any>resultSchema).choiceType.type === SchemaType.Boolean && (<SealedChoiceSchema>resultSchema).choices.length === 1)) { |
2669 | 2671 | outputTypes.add(`typeof(${dotnet.Bool})`); |
2670 | 2672 | } else { |
2671 | 2673 | const typeDeclaration = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(resultSchema, true, this.state); |
|
0 commit comments