Skip to content

Commit

Permalink
Handle unkown type as any type in m4 (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolauli authored Nov 26, 2024
1 parent db95d41 commit ff7132a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/typespec-powershell/src/utils/modelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
import { SdkContext, isReadOnly } from "@azure-tools/typespec-client-generator-core";

import { reportDiagnostic } from "../lib.js";
import { SealedChoiceSchema, ChoiceSchema, ChoiceValue, SchemaType, ArraySchema, Schema, DictionarySchema, ObjectSchema, Discriminator as M4Discriminator, Property, StringSchema, NumberSchema, ConstantSchema, ConstantValue } from "@autorest/codemodel";
import { AnySchema, SealedChoiceSchema, ChoiceSchema, ChoiceValue, SchemaType, ArraySchema, Schema, DictionarySchema, ObjectSchema, Discriminator as M4Discriminator, Property, StringSchema, NumberSchema, ConstantSchema, ConstantValue } from "@autorest/codemodel";
import {
getHeaderFieldName,
getPathParamName,
Expand Down Expand Up @@ -290,11 +290,9 @@ export function getSchemaForType(
return getSchemaForEnumMember(program, type);
}
if (isUnknownType(type)) {
const returnType: any = { type: "unknown" };
if (usage && usage.includes(SchemaContext.Output)) {
returnType.outputTypeName = "any";
returnType.typeName = "unknown";
}
// Unknown type, return any schema
const returnType = new AnySchema("any");
schemaCache.set(type, returnType);
return returnType;
}
if (isNeverType(type)) {
Expand Down

0 comments on commit ff7132a

Please sign in to comment.