Skip to content

Commit

Permalink
refacotr(emitter): align file names with microsoft/typespec (#4704)
Browse files Browse the repository at this point in the history
Change file names of emitter to align with those under `microsoft/typespec`.
That will make code migration much eaiser.

resolve #4703

Co-authored-by: Mingzhe Huang (from Dev Box) <mingzhehuang@microsoft.com>
  • Loading branch information
archerzz and Mingzhe Huang (from Dev Box) committed May 14, 2024
1 parent e4254f2 commit 9b5d6e9
Show file tree
Hide file tree
Showing 47 changed files with 113 additions and 113 deletions.
2 changes: 1 addition & 1 deletion src/TypeSpec.Extension/Emitter.Csharp/src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
resolveOptions,
resolveOutputFolder
} from "./options.js";
import { createModel } from "./lib/clientModelBuilder.js";
import { createModel } from "./lib/client-model-builder.js";
import { logger, LoggerLevel } from "./lib/logger.js";
import { tspOutputFileName, configurationFileName } from "./constants.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ import {
import { getVersions } from "@typespec/versioning";
import { $lib } from "../emitter.js";
import { NetEmitterOptions, resolveOptions } from "../options.js";
import { ClientKind } from "../type/clientKind.js";
import { CodeModel } from "../type/codeModel.js";
import { InputClient } from "../type/inputClient.js";
import { InputConstant } from "../type/inputConstant.js";
import { InputOperation } from "../type/inputOperation.js";
import { InputOperationParameterKind } from "../type/inputOperationParameterKind.js";
import { InputParameter } from "../type/inputParameter.js";
import { ClientKind } from "../type/client-kind.js";
import { CodeModel } from "../type/code-model.js";
import { InputClient } from "../type/input-client.js";
import { InputConstant } from "../type/input-constant.js";
import { InputOperation } from "../type/input-operation.js";
import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
import { InputParameter } from "../type/input-parameter.js";
import {
InputEnumType,
InputModelType,
InputPrimitiveType
} from "../type/inputType.js";
import { InputPrimitiveTypeKind } from "../type/inputPrimitiveTypeKind.js";
import { RequestLocation } from "../type/requestLocation.js";
} from "../type/input-type.js";
import { InputPrimitiveTypeKind } from "../type/input-primitive-type-kind.js";
import { RequestLocation } from "../type/request-location.js";
import { Usage } from "../type/usage.js";
import { logger } from "./logger.js";
import { getUsages, navigateModels } from "./model.js";
import { loadOperation } from "./operation.js";
import { processServiceAuthentication } from "./serviceAuthentication.js";
import { processServiceAuthentication } from "./service-authentication.js";
import { resolveServers } from "./typespecServer.js";
import { createContentTypeOrAcceptParameter } from "./utils.js";
import { InputTypeKind } from "../type/inputTypeKind.js";
import { InputTypeKind } from "../type/input-type-kind.js";

export function createModel(
sdkContext: SdkContext<NetEmitterOptions>
Expand Down
14 changes: 7 additions & 7 deletions src/TypeSpec.Extension/Emitter.Csharp/src/lib/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import {
} from "@typespec/compiler";
import { logger } from "./logger.js";
import { getFullNamespaceString } from "./utils.js";
import { InputEnumTypeValue } from "../type/inputEnumTypeValue.js";
import { InputIntrinsicTypeKind } from "../type/inputIntrinsicTypeKind.js";
import { InputModelProperty } from "../type/inputModelProperty.js";
import { InputPrimitiveTypeKind } from "../type/inputPrimitiveTypeKind.js";
import { InputEnumTypeValue } from "../type/input-enum-type-value.js";
import { InputIntrinsicTypeKind } from "../type/input-intrinsic-type-kind.js";
import { InputModelProperty } from "../type/input-model-property.js";
import { InputPrimitiveTypeKind } from "../type/input-primitive-type-kind.js";
import {
InputDictionaryType,
InputEnumType,
Expand All @@ -47,9 +47,9 @@ import {
InputPrimitiveType,
InputType,
InputUnionType
} from "../type/inputType.js";
import { InputTypeKind } from "../type/inputTypeKind.js";
import { LiteralTypeContext } from "../type/literalTypeContext.js";
} from "../type/input-type.js";
import { InputTypeKind } from "../type/input-type-kind.js";
import { LiteralTypeContext } from "../type/literal-type-context.js";
import { Usage } from "../type/usage.js";

export function fromSdkType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

import { DecoratedType, Operation, Type } from "@typespec/compiler";
import { ExternalDocs } from "../type/externalDocs.js";
import { ExternalDocs } from "../type/external-docs.js";
import { SdkContext } from "@azure-tools/typespec-client-generator-core";

const externalDocsKey = Symbol("externalDocs");
Expand Down
4 changes: 2 additions & 2 deletions src/TypeSpec.Extension/Emitter.Csharp/src/lib/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import {
InputType,
isInputEnumType,
isInputLiteralType
} from "../type/inputType.js";
import { LiteralTypeContext } from "../type/literalTypeContext.js";
} from "../type/input-type.js";
import { LiteralTypeContext } from "../type/literal-type-context.js";
import { logger } from "./logger.js";
import { capitalize, getTypeName } from "./utils.js";

Expand Down
30 changes: 15 additions & 15 deletions src/TypeSpec.Extension/Emitter.Csharp/src/lib/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import {
HttpOperationResponse
} from "@typespec/http";
import { NetEmitterOptions } from "../options.js";
import { BodyMediaType, typeToBodyMediaType } from "../type/bodyMediaType.js";
import { collectionFormatToDelimMap } from "../type/collectionFormat.js";
import { HttpResponseHeader } from "../type/httpResponseHeader.js";
import { InputConstant } from "../type/inputConstant.js";
import { InputOperation } from "../type/inputOperation.js";
import { InputOperationParameterKind } from "../type/inputOperationParameterKind.js";
import { InputParameter } from "../type/inputParameter.js";
import { BodyMediaType, typeToBodyMediaType } from "../type/body-media-type.js";
import { collectionFormatToDelimMap } from "../type/collection-format.js";
import { HttpResponseHeader } from "../type/http-response-header.js";
import { InputConstant } from "../type/input-constant.js";
import { InputOperation } from "../type/input-operation.js";
import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
import { InputParameter } from "../type/input-parameter.js";
import {
InputEnumType,
InputListType,
Expand All @@ -42,19 +42,19 @@ import {
isInputLiteralType,
isInputModelType,
isInputUnionType
} from "../type/inputType.js";
import { convertLroFinalStateVia } from "../type/operationFinalStateVia.js";
import { OperationLongRunning } from "../type/operationLongRunning.js";
import { OperationPaging } from "../type/operationPaging.js";
import { OperationResponse } from "../type/operationResponse.js";
} from "../type/input-type.js";
import { convertLroFinalStateVia } from "../type/operation-final-state-via.js";
import { OperationLongRunning } from "../type/operation-long-running.js";
import { OperationPaging } from "../type/operation-paging.js";
import { OperationResponse } from "../type/operation-response.js";
import {
RequestLocation,
requestLocationMap
} from "../type/requestLocation.js";
} from "../type/request-location.js";
import {
parseHttpRequestMethod,
RequestMethod
} from "../type/requestMethod.js";
} from "../type/request-method.js";
import { getExternalDocs, getOperationId, hasDecorator } from "./decorators.js";
import { logger } from "./logger.js";
import {
Expand All @@ -68,7 +68,7 @@ import {
getTypeName
} from "./utils.js";
import { Usage } from "../type/usage.js";
import { InputTypeKind } from "../type/inputTypeKind.js";
import { InputTypeKind } from "../type/input-type-kind.js";

export function loadOperation(
sdkContext: SdkContext<NetEmitterOptions>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

import { ServiceAuthentication } from "@typespec/http";
import { InputApiKeyAuth } from "../type/inputApiKeyAuth.js";
import { InputAuth } from "../type/inputAuth.js";
import { InputOAuth2Auth } from "../type/inputOAuth2Auth.js";
import { InputApiKeyAuth } from "../type/input-api-key-auth.js";
import { InputAuth } from "../type/input-auth.js";
import { InputOAuth2Auth } from "../type/input-oauth2-auth.js";
import { logger } from "./logger.js";

export function processServiceAuthentication(
Expand Down
14 changes: 7 additions & 7 deletions src/TypeSpec.Extension/Emitter.Csharp/src/lib/typespecServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

import { getDoc } from "@typespec/compiler";
import { HttpServer } from "@typespec/http";
import { InputConstant } from "../type/inputConstant.js";
import { InputOperationParameterKind } from "../type/inputOperationParameterKind.js";
import { InputParameter } from "../type/inputParameter.js";
import { InputConstant } from "../type/input-constant.js";
import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
import { InputParameter } from "../type/input-parameter.js";
import {
InputEnumType,
InputModelType,
InputPrimitiveType,
InputType
} from "../type/inputType.js";
import { InputPrimitiveTypeKind } from "../type/inputPrimitiveTypeKind.js";
import { RequestLocation } from "../type/requestLocation.js";
} from "../type/input-type.js";
import { InputPrimitiveTypeKind } from "../type/input-primitive-type-kind.js";
import { RequestLocation } from "../type/request-location.js";
import { getDefaultValue, getInputType } from "./model.js";
import { SdkContext } from "@azure-tools/typespec-client-generator-core";
import { InputTypeKind } from "../type/inputTypeKind.js";
import { InputTypeKind } from "../type/input-type-kind.js";
import { NetEmitterOptions } from "../options.js";

export interface TypeSpecServer {
Expand Down
14 changes: 7 additions & 7 deletions src/TypeSpec.Extension/Emitter.Csharp/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
getLibraryName,
getSdkModel
} from "@azure-tools/typespec-client-generator-core";
import { InputParameter } from "../type/inputParameter.js";
import { InputPrimitiveType, InputType } from "../type/inputType.js";
import { InputPrimitiveTypeKind } from "../type/inputPrimitiveTypeKind.js";
import { RequestLocation } from "../type/requestLocation.js";
import { InputOperationParameterKind } from "../type/inputOperationParameterKind.js";
import { InputConstant } from "../type/inputConstant.js";
import { InputTypeKind } from "../type/inputTypeKind.js";
import { InputParameter } from "../type/input-parameter.js";
import { InputPrimitiveType, InputType } from "../type/input-type.js";
import { InputPrimitiveTypeKind } from "../type/input-primitive-type-kind.js";
import { RequestLocation } from "../type/request-location.js";
import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
import { InputConstant } from "../type/input-constant.js";
import { InputTypeKind } from "../type/input-type-kind.js";

export function capitalize(str: string): string {
return str.charAt(0).toUpperCase() + str.slice(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputAuth } from "./inputAuth.js";
import { InputClient } from "./inputClient.js";
import { InputEnumType, InputModelType } from "./inputType.js";
import { InputAuth } from "./input-auth.js";
import { InputClient } from "./input-client.js";
import { InputEnumType, InputModelType } from "./input-type.js";

export interface CodeModel {
Name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputType } from "./inputType.js";
import { InputType } from "./input-type.js";

export interface HttpResponseHeader {
Name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputApiKeyAuth } from "./inputApiKeyAuth.js";
import { InputOAuth2Auth } from "./inputOAuth2Auth.js";
import { InputApiKeyAuth } from "./input-api-key-auth.js";
import { InputOAuth2Auth } from "./input-oauth2-auth.js";

export interface InputAuth {
ApiKey?: InputApiKeyAuth;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputOperation } from "./inputOperation.js";
import { InputParameter } from "./inputParameter.js";
import { InputOperation } from "./input-operation.js";
import { InputParameter } from "./input-parameter.js";
import { Protocols } from "./protocols.js";

export interface InputClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputType } from "./inputType.js";
import { InputType } from "./input-type.js";

export interface InputConstant {
Value?: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputType } from "./inputType.js";
import { InputType } from "./input-type.js";

export interface InputModelProperty {
Name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { BodyMediaType } from "./bodyMediaType.js";
import { OperationLongRunning } from "./operationLongRunning.js";
import { OperationPaging } from "./operationPaging.js";
import { InputParameter } from "./inputParameter.js";
import { OperationResponse } from "./operationResponse.js";
import { RequestMethod } from "./requestMethod.js";
import { BodyMediaType } from "./body-media-type.js";
import { OperationLongRunning } from "./operation-long-running.js";
import { OperationPaging } from "./operation-paging.js";
import { InputParameter } from "./input-parameter.js";
import { OperationResponse } from "./operation-response.js";
import { RequestMethod } from "./request-method.js";

export interface Paging {
NextLinkName?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputConstant } from "./inputConstant.js";
import { InputOperationParameterKind } from "./inputOperationParameterKind.js";
import { InputType } from "./inputType.js";
import { RequestLocation } from "./requestLocation.js";
import { InputConstant } from "./input-constant.js";
import { InputOperationParameterKind } from "./input-operation-parameter-kind.js";
import { InputType } from "./input-type.js";
import { RequestLocation } from "./request-location.js";

//TODO: Define VirtualParameter for HLC
export interface VirtualParameter {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputEnumTypeValue } from "./inputEnumTypeValue.js";
import { InputIntrinsicTypeKind } from "./inputIntrinsicTypeKind.js";
import { InputModelProperty } from "./inputModelProperty.js";
import { InputPrimitiveTypeKind } from "./inputPrimitiveTypeKind.js";
import { InputTypeKind } from "./inputTypeKind.js";
import { InputEnumTypeValue } from "./input-enum-type-value.js";
import { InputIntrinsicTypeKind } from "./input-intrinsic-type-kind.js";
import { InputModelProperty } from "./input-model-property.js";
import { InputPrimitiveTypeKind } from "./input-primitive-type-kind.js";
import { InputTypeKind } from "./input-type-kind.js";

export interface InputType {
Name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { OperationFinalStateVia } from "./operationFinalStateVia.js";
import { OperationResponse } from "./operationResponse.js";
import { OperationFinalStateVia } from "./operation-final-state-via.js";
import { OperationResponse } from "./operation-response.js";

export interface OperationLongRunning {
FinalStateVia: OperationFinalStateVia;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { InputOperation } from "./inputOperation.js";
import { InputOperation } from "./input-operation.js";

export interface OperationPaging {
NextLinkName?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { BodyMediaType } from "./bodyMediaType.js";
import { HttpResponseHeader } from "./httpResponseHeader.js";
import { InputType } from "./inputType.js";
import { BodyMediaType } from "./body-media-type.js";
import { HttpResponseHeader } from "./http-response-header.js";
import { InputType } from "./input-type.js";

export interface OperationResponse {
StatusCodes: number[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { getAllHttpServices } from "@typespec/http";
import assert from "assert";
import isEqual from "lodash.isequal";
import { loadOperation } from "../../src/lib/operation.js";
import { InputPrimitiveTypeKind } from "../../src/type/inputPrimitiveTypeKind.js";
import { InputPrimitiveTypeKind } from "../../src/type/input-primitive-type-kind.js";
import {
InputEnumType,
InputModelType,
InputPrimitiveType
} from "../../src/type/inputType.js";
import { InputTypeKind } from "../../src/type/inputTypeKind.js";
} from "../../src/type/input-type.js";
import { InputTypeKind } from "../../src/type/input-type-kind.js";
import {
createEmitterContext,
createEmitterTestHost,
createNetSdkContext,
navigateModels,
typeSpecCompile
} from "./utils/TestUtil.js";
} from "./utils/test-util.js";

describe("Test encode duration", () => {
let runner: TestHost;
Expand Down
Loading

0 comments on commit 9b5d6e9

Please sign in to comment.