Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions packages/typespec-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export async function $onEmit(context: EmitContext) {
console.timeEnd("onEmit: build RLC code models");

// 4. Generate sources
if (emitterOptions.isModularLibrary) {
if (emitterOptions["is-modular-library"]) {
await generateModularSources();
} else {
await generateRLCSources();
Expand All @@ -180,8 +180,8 @@ export async function $onEmit(context: EmitContext) {
await calculateGenerationDir();
dpgContext.generationPathDetail = generationPathDetail;
const options: RLCOptions = transformRLCOptions(emitterOptions, dpgContext);
emitterOptions.isModularLibrary = options.isModularLibrary;
emitterOptions.generateSample = options.generateSample;
emitterOptions["is-modular-library"] = options.isModularLibrary;
emitterOptions["generate-sample"] = options.generateSample;
// clear output folder if needed
if (options.clearOutputFolder) {
await fsextra.emptyDir(context.emitterOutputDir);
Expand Down Expand Up @@ -345,7 +345,7 @@ export async function $onEmit(context: EmitContext) {
}
console.timeEnd("onEmit: emit source files");
// Enable modular sample generation when explicitly set to true or MPG
if (emitterOptions.generateSample === true) {
if (emitterOptions["generate-sample"] === true) {
console.time("onEmit: emit samples");
const samples = emitSamples(dpgContext);
console.timeEnd("onEmit: emit samples");
Expand Down
106 changes: 2 additions & 104 deletions packages/typespec-ts/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
PackageDetails,
DependencyInfo,
ServiceInfo,
PackageFlavor,
RLCOptions
PackageFlavor
} from "@azure-tools/rlc-common";
import {
createTypeSpecLibrary,
Expand All @@ -15,7 +14,7 @@ import {
} from "@typespec/compiler";
import { Options } from "prettier";

export interface EmitterOptions extends RLCOptions {
export interface EmitterOptions {
"include-shortcuts"?: boolean;
"multi-client"?: boolean;
batch?: any[];
Expand Down Expand Up @@ -71,105 +70,10 @@ export interface EmitterOptions extends RLCOptions {
"default-value-object"?: boolean;
}

const _RLCOptionsSchema: JSONSchemaType<RLCOptions> = {
type: "object",
additionalProperties: true,
properties: {
includeShortcuts: { type: "boolean", nullable: true },
multiClient: { type: "boolean", nullable: true },
batch: {
type: "array",
nullable: true,
items: {
type: "string"
}
},
packageDetails: {
type: "object",
additionalProperties: true,
properties: {
name: { type: "string", nullable: false },
scopeName: { type: "string", nullable: true },
nameWithoutScope: { type: "string", nullable: true },
description: { type: "string", nullable: true },
version: { type: "string", nullable: true }
},
required: ["name"],
nullable: true
},
addCredentials: { type: "boolean", nullable: true },
credentialScopes: {
type: "array",
nullable: true,
items: { type: "string" }
},
credentialKeyHeaderName: { type: "string", nullable: true },
customHttpAuthHeaderName: { type: "string", nullable: true },
customHttpAuthSharedKeyPrefix: { type: "string", nullable: true },
generateMetadata: { type: "boolean", nullable: true },
generateTest: { type: "boolean", nullable: true },
generateSample: { type: "boolean", nullable: true },
azureSdkForJs: { type: "boolean", nullable: true },
azureOutputDirectory: { type: "string", nullable: true },
isTypeSpecTest: { type: "boolean", nullable: true },
title: { type: "string", nullable: true },
dependencyInfo: {
type: "object",
additionalProperties: true,
properties: {
link: { type: "string", nullable: false },
description: { type: "string", nullable: false }
},
required: [],
nullable: true
},
productDocLink: { type: "string", nullable: true },
serviceInfo: {
type: "object",
additionalProperties: true,
properties: {
title: { type: "string", nullable: true },
description: { type: "string", nullable: true }
},
nullable: true
},
azureArm: { type: "boolean", nullable: true },
sourceFrom: { type: "string", nullable: true },
isModularLibrary: { type: "boolean", nullable: true, default: false },
enableOperationGroup: { type: "boolean", nullable: true },
enableModelNamespace: { type: "boolean", nullable: true },
hierarchyClient: { type: "boolean", nullable: true },
branded: { type: "boolean", nullable: true },
flavor: { type: "string", nullable: true },
moduleKind: {
type: "string",
nullable: true,
enum: ["esm", "cjs"],
default: "esm"
},
compatibilityMode: { type: "boolean", nullable: true },
experimentalExtensibleEnums: { type: "boolean", nullable: true },
clearOutputFolder: { type: "boolean", nullable: true },
ignorePropertyNameNormalize: { type: "boolean", nullable: true },
ignoreEnumMemberNameNormalize: { type: "boolean", nullable: true },
compatibilityQueryMultiFormat: { type: "boolean", nullable: true },
typespecTitleMap: {
type: "object",
additionalProperties: {
type: "string"
},
required: [],
nullable: true
}
},
required: []
};

export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
type: "object",
additionalProperties: true,
properties: {
..._RLCOptionsSchema.properties,
"include-shortcuts": { type: "boolean", nullable: true },
"multi-client": { type: "boolean", nullable: true },
batch: {
Expand Down Expand Up @@ -384,12 +288,6 @@ const libDef = {
default: paramMessage`Please note the decimal type will be converted to number. If you strongly care about precision you can use @encode to encode it as a string for the property - ${"propertyName"}.`
}
},
"use-kebab-case-option": {
severity: "warning",
messages: {
default: paramMessage`The option - ${"camelCaseOption"} is deprecated and please use this kebab-case one - ${"kebabCaseOption"}.`
}
},
"unable-serialized-type": {
severity: "warning",
messages: {
Expand Down
Loading
Loading