Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unknown type as any type in m4 #1412

Merged
merged 1 commit into from
Nov 26, 2024
Merged
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
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
Loading