Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions powershell/internal/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { codemodel, PropertyDetails, exportedModels as T, ModelState, JsonType,
import { DeepPartial } from '@azure-tools/codegen';
import { PwshModel } from '../utils/PwshModel';
import { NewModelState } from '../utils/model-state';
import { BooleanSchema, ConstantSchema, Schema as NewSchema, SchemaType } from '@azure-tools/codemodel';
import { BooleanSchema, ChoiceSchema, ConstantSchema, Schema as NewSchema, SchemaType } from '@azure-tools/codemodel';

export type Schema = T.SchemaT<LanguageDetails<SchemaDetails>, LanguageDetails<PropertyDetails>>;

Expand Down Expand Up @@ -72,7 +72,9 @@ export class NewPSSchemaResolver extends NewSchemaDefinitionResolver {
try {
if (!this.inResolve) {
this.inResolve = true;
if (schema && (schema.type === SchemaType.Boolean || (schema.type === SchemaType.Constant && (<ConstantSchema>schema).valueType.type === SchemaType.Boolean))) {
if (schema && (schema.type === SchemaType.Boolean
|| (schema.type === SchemaType.Constant && (<ConstantSchema>schema).valueType.type === SchemaType.Boolean)
|| (schema.type === SchemaType.Choice && (<any>schema).choiceType.type === SchemaType.Boolean))) {
return new NewPSSwitch(<BooleanSchema>schema, required);
}
}
Expand Down
6 changes: 1 addition & 5 deletions powershell/llcsharp/schema/schema-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,7 @@ export class NewSchemaDefinitionResolver {
return this.resolveTypeDeclaration((<ConstantSchema>schema).valueType, required, state);

case SchemaType.Choice: {
const choiceSchema = schema as ChoiceSchema;
if ((<any>choiceSchema.choiceType).type === SchemaType.DateTime && (<any>choiceSchema.choiceType).format === StringFormat.DateTimeRfc1123) {
return new NewDateTime1123(schema as DateTimeSchema, required);
}
return new NewString(schema, required);
return this.resolveTypeDeclaration((<ChoiceSchema>schema).choiceType, required, state);
}
case SchemaType.SealedChoice:
if (schema.language.default.skip === true) {
Expand Down