Fix issues over model generation

This commit is contained in:
markcowl 2021-06-08 14:18:55 -07:00
Родитель ba3de996f6
Коммит 9d596f6c83
1 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -1,7 +1,28 @@
import { NamespaceType, Program, throwDiagnostic, Type } from "@azure-tools/adl";
import { NamespaceType, OperationType, Program, throwDiagnostic, Type } from "@azure-tools/adl";
const basePaths = new Map<Type, string>();
export interface HttpOperationType extends OperationType {
basePath: string,
route: OperationRoute
}
export function getHttpOperation(operation: OperationType) : HttpOperationType | undefined {
if (!isResource(operation)) {
return undefined;
}
return {
basePath: basePathForResource(operation)!,
route: getOperationRoute(operation)!,
kind: operation.kind,
name: operation.name,
node: operation.node,
returnType: operation.returnType,
namespace: operation.namespace,
parameters: operation.parameters
};
}
export function resource(program: Program, entity: Type, basePath = "") {
if (entity.kind !== "Namespace") return;
basePaths.set(entity, basePath);