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

Update the cadl-ranch version to latest part 1 #1907

Merged
merged 8 commits into from
Jun 30, 2023
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
136 changes: 36 additions & 100 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function getParameterSchema(
typeName: schema.name
};
}
if (type === "Array<string>") {
if (type === "Array<string>" || type === "Array<number>") {
const serializeInfo = getSpecialSerializeInfo(parameter);
if (serializeInfo.hasMultiCollection || serializeInfo.hasPipeCollection || serializeInfo.hasSsvCollection || serializeInfo.hasTsvCollection) {
type = "string";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export function buildPipeCollection(items: string[]): string {
export function buildPipeCollection(items: string[] | number[]): string {
MaryGao marked this conversation as resolved.
Show resolved Hide resolved
return items.join("|");
}

export function buildSsvCollection(items: string[]): string {
export function buildSsvCollection(items: string[] | number[]): string {
return items.join(" ");
}

export function buildTsvCollection(items: string[]) {
export function buildTsvCollection(items: string[] | number[]) {
return items.join("\t");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3713,7 +3713,7 @@ export interface ScenesListQueryParamProperties {
farmerId: string;
imageFormats?: string;
imageNames?: string;
imageResolutions?: Array<number>;
imageResolutions?: string;
maxCloudCoveragePercentage?: number;
maxDarkPixelCoveragePercentage?: number;
provider: string;
Expand Down Expand Up @@ -4206,7 +4206,7 @@ export interface SeasonsListQueryParamProperties {
names?: string;
propertyFilters?: string;
statuses?: string;
years?: Array<number>;
years?: string;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1374,8 +1374,8 @@ export interface ScenesListQueryParamProperties {
maxDarkPixelCoveragePercentage?: number;
/** List of image names to be filtered. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
imageNames?: string;
/** List of image resolutions in meters to be filtered. */
imageResolutions?: Array<number>;
/** List of image resolutions in meters to be filtered. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
imageResolutions?: string;
/** List of image formats to be filtered. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
imageFormats?: string;
/**
Expand Down Expand Up @@ -1586,8 +1586,8 @@ export interface SeasonsListQueryParamProperties {
minEndDateTime?: Date | string;
/** Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. */
maxEndDateTime?: Date | string;
/** Years of the resource. */
years?: Array<number>;
/** Years of the resource. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
years?: string;
/** Ids of the resource. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
ids?: string;
/** Names of the resource. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */
Expand Down
8 changes: 4 additions & 4 deletions packages/rlc-common/src/static/serializeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ export function buildMultiCollection(
}`;

export const buildPipeCollectionContent = `
export function buildPipeCollection(items: string[]): string {
export function buildPipeCollection(items: string[] | number[]): string {
return items.join("|");
}`;

export const buildSsvCollectionContent = `
export function buildSsvCollection(items: string[]): string {
export function buildSsvCollection(items: string[] | number[]): string {
return items.join(" ");
}`;

export const buildTsvCollectionContent = `
export function buildTsvCollection(items: string[]) {
export function buildTsvCollection(items: string[] | number[]) {
return items.join("\\t");
}`;

export const buildCsvCollectionContent = `
export function buildCsvCollection(items: string[]) {
export function buildCsvCollection(items: string[] | number[]) {
return items.join(",");
}`;
6 changes: 3 additions & 3 deletions packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"ts-node": "^10.9.1",
"typescript": "~5.0.0",
"prettier": "~2.7.1",
"@azure-tools/cadl-ranch-specs": "^0.15.4",
"@azure-tools/cadl-ranch-expect": "^0.3.2",
"@azure-tools/cadl-ranch": "^0.4.17",
"@azure-tools/cadl-ranch-specs": "^0.16.2",
"@azure-tools/cadl-ranch-expect": "^0.4.0",
"@azure-tools/cadl-ranch": "^0.5.1",
"chalk": "^4.0.0",
"@azure-rest/core-client": "^1.1.3",
"@azure/core-auth": "^1.3.2",
Expand Down
7 changes: 6 additions & 1 deletion packages/typespec-ts/src/transform/transformParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ function getParameterMetadata(
const name = getParameterName(parameter.name);
let description =
getFormattedPropertyDoc(program, parameter.param, schema) ?? "";
if (type === "string[]" || type === "Array<string>") {
if (
type === "string[]" ||
type === "Array<string>" ||
type === "number[]" ||
type === "Array<number>"
) {
const serializeInfo = getSpecialSerializeInfo(parameter);
if (
serializeInfo.hasMultiCollection ||
Expand Down
16 changes: 14 additions & 2 deletions packages/typespec-ts/test/commands/cadl-ranch-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ export interface CadlRanchConfig {

export const cadls: CadlRanchConfig[] = [
{
outputPath: "encode",
outputPath: "headers/repeatability",
inputPath: "special-headers/repeatability"
},
{
outputPath: "parameters/body-optionality",
inputPath: "parameters/body-optionality"
},
{
outputPath: "encode/duration",
inputPath: "encode/duration"
},
{
outputPath: "encode/datetime",
inputPath: "encode/datetime"
},
{
outputPath: "sharedRoute",
inputPath: "shared-route"
Expand Down Expand Up @@ -55,7 +67,7 @@ export const cadls: CadlRanchConfig[] = [
},
{
outputPath: "lro/lroRPC",
inputPath: "azure/core/lro/rpc"
inputPath: "azure/core/lro/rpc/legacy"
},
{
outputPath: "models/inheritance",
Expand Down
Loading
Loading