Fix endpoint handling (#4164)
This commit is contained in:
Родитель
67adf07c3f
Коммит
2c8d4e2185
|
@ -19,6 +19,7 @@ import { InputOperationParameterKind } from "../type/input-operation-parameter-k
|
|||
import { InputParameter } from "../type/input-parameter.js";
|
||||
import { InputEnumType, InputModelType, InputType } from "../type/input-type.js";
|
||||
import { RequestLocation } from "../type/request-location.js";
|
||||
import { fromSdkType } from "./converter.js";
|
||||
import { Logger } from "./logger.js";
|
||||
import { navigateModels } from "./model.js";
|
||||
import { fromSdkServiceMethod, getParameterDefaultValue } from "./operation-converter.js";
|
||||
|
@ -153,11 +154,7 @@ export function createModel(sdkContext: SdkContext<NetEmitterOptions>): CodeMode
|
|||
Name: "url",
|
||||
CrossLanguageDefinitionId: "TypeSpec.url",
|
||||
}
|
||||
: {
|
||||
Kind: "string",
|
||||
Name: "string",
|
||||
CrossLanguageDefinitionId: "TypeSpec.string",
|
||||
};
|
||||
: fromSdkType(parameter.type, sdkContext, modelMap, enumMap); // TODO: consolidate with converter.fromSdkEndpointType
|
||||
parameters.push({
|
||||
Name: parameter.name,
|
||||
NameInRequest: parameter.serializedName,
|
||||
|
|
|
@ -53,6 +53,7 @@ export function fromSdkType(
|
|||
} as InputNullableType;
|
||||
}
|
||||
if (sdkType.kind === "model") return fromSdkModelType(sdkType, context, models, enums);
|
||||
if (sdkType.kind === "endpoint") return fromSdkEndpointType();
|
||||
if (sdkType.kind === "enum") return fromSdkEnumType(sdkType, context, enums);
|
||||
if (sdkType.kind === "enumvalue")
|
||||
return fromSdkEnumValueTypeToConstantType(sdkType, context, enums, literalTypeContext);
|
||||
|
@ -68,7 +69,6 @@ export function fromSdkType(
|
|||
// TODO -- endpoint and credential are handled separately in emitter, since we have specific locations for them in input model.
|
||||
// We can handle unify the way we handle them in the future, probably by chaning the input model schema and do the conversion in generator.
|
||||
if (sdkType.kind === "credential") throw new Error("Credential type is not supported yet.");
|
||||
if (sdkType.kind === "endpoint") throw new Error("Endpoint type is not supported yet.");
|
||||
|
||||
return fromSdkBuiltInType(sdkType);
|
||||
}
|
||||
|
@ -381,3 +381,11 @@ function fromSdkArrayType(
|
|||
CrossLanguageDefinitionId: arrayType.crossLanguageDefinitionId,
|
||||
};
|
||||
}
|
||||
|
||||
function fromSdkEndpointType(): InputPrimitiveType {
|
||||
return {
|
||||
Kind: "string",
|
||||
Name: "string",
|
||||
CrossLanguageDefinitionId: "TypeSpec.string",
|
||||
};
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче