Skip to content

[DNM] Validate typespec-azure#2974 #36014

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b95b8ef
Remove experimentation child resource (#35790)
hahahahahaiyiwen Jul 17, 2025
356c5f0
Monitor Ingestion TypeSpec Updates for Java (#35985)
jairmyree Jul 17, 2025
9e1be6b
[Monitor Query] Add TypeSpec for Logs Query (#35723)
pvaneck Jul 17, 2025
70f1d7c
Update oav to 3.6.3 (#35997)
mikeharder Jul 17, 2025
8ba4310
[Monitor] Rename Metrics Query TypeSpec directory (#35989)
pvaneck Jul 17, 2025
3d00012
[Monitor] Rename Ingestion TypeSpec directory (#35991)
pvaneck Jul 17, 2025
d157a1d
[DevTestLabs] Convert existing OpenAPI spec to TypeSpec spec (#35346)
nandiniYeltiwar Jul 17, 2025
fd22902
Stable Version 2025-07-15 for Microsoft.Quota (#35765)
tejasm-microsoft Jul 17, 2025
d62dbc8
[spec-model] Add cache in ctor, to re-use objects for the same path (…
mikeharder Jul 17, 2025
63aa8b9
[Monitor Query Logs] Add Java customizations (#36007)
srnagar Jul 17, 2025
3494ddd
Initial fixes
AlitzelMendez Jul 18, 2025
354b098
[EngSys] Remove unnecessary workflow_dispatch triggers (#36019)
mikeharder Jul 18, 2025
ba0345b
[dashboard] Remove properties order fix and fix location to be option…
welovej Jul 18, 2025
e22d364
fix the back compatible for csharp (#35965)
ArcturusZhang Jul 18, 2025
4fd4932
add client customizations for csharp for botservice (#35973)
ArcturusZhang Jul 18, 2025
42b9cee
Fix file path in examples (#35584)
yitaopan Jul 18, 2025
471eab6
[Monitor Query Logs] fix model attribute types (#36015)
gracewilcox Jul 18, 2025
3c33d5b
Updating to use @pageItems and @list decorators
AlitzelMendez Jul 18, 2025
986fcfd
first commit (#35929)
koyasu221b Jul 18, 2025
f1dc99d
typespec conversion (#36040)
gracewilcox Jul 18, 2025
3d89088
Merge branch 'main' into validate-pr-2974
AlitzelMendez Jul 18, 2025
ced7d6e
Updating to use @pageItems and @list decorators v2
AlitzelMendez Jul 18, 2025
c7d2062
Updating to use @pageItems and @list decorators v3
AlitzelMendez Jul 18, 2025
13a2720
Updating to use @pageItems and @list decorators v4
AlitzelMendez Jul 18, 2025
a8824ba
Merge branch 'typespec-next' of https://github.com/Azure/azure-rest-a…
timotheeguerin Jul 23, 2025
4f23063
fix lock
timotheeguerin Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/actions/setup-node-install-deps/action.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: Setup Node and install dependencies
description: Uses specified Node version and installs dependencies (typically using "npm")

Expand All @@ -7,7 +7,7 @@
default: 22.x
install-command:
description: "Command to install dependencies"
default: "npm ci"
default: "npm i --no-package-lock --force"
working-directory:
description: "Working directory"
default: "."
Expand Down
15 changes: 14 additions & 1 deletion .github/shared/src/spec-model.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @ts-check

import { readdir } from "fs/promises";
Expand All @@ -5,6 +5,9 @@
import { flatMapAsync, mapAsync } from "./array.js";
import { Readme } from "./readme.js";

/** @type {Map<string, SpecModel>} */
const specModelCache = new Map();

/**
* @typedef {Object} ToJSONOptions
* @prop {boolean} [includeRefs]
Expand All @@ -16,6 +19,7 @@

export class SpecModel {
/** @type {string} absolute path */
// @ts-ignore Ignore error that value may not be set in ctor (since we may returned cached value)
#folder;

/** @type {import('./logger.js').ILogger | undefined} */
Expand All @@ -30,8 +34,17 @@
* @param {import('./logger.js').ILogger} [options.logger]
*/
constructor(folder, options) {
this.#folder = resolve(folder);
const resolvedFolder = resolve(folder);

const cachedSpecModel = specModelCache.get(resolvedFolder);
if (cachedSpecModel !== undefined) {
return cachedSpecModel;
}

this.#folder = resolvedFolder;
this.#logger = options?.logger;

specModelCache.set(resolvedFolder, this);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions .github/shared/test/spec-model.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check

import { randomUUID } from "crypto";
import { readdir } from "fs/promises";
import { dirname, isAbsolute, join, resolve } from "path";
import { describe, expect, it } from "vitest";
Expand All @@ -18,6 +19,15 @@
await expect(specModel.getReadmes()).rejects.toThrowError(/no such file or directory/i);
});

it("returns cached spec model", async () => {
const path = randomUUID();

const specModel1 = new SpecModel(path);
const specModel2 = new SpecModel(path);

expect(specModel1).toBe(specModel2);
});

it("returns spec model", async () => {
const folder = resolve(
__dirname,
Expand Down
26 changes: 23 additions & 3 deletions .github/shared/test/swagger.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @ts-check

import { dirname, resolve, join } from "path";
import { dirname, join, resolve } from "path";
import { describe, expect, it } from "vitest";
import { Swagger } from "../src/swagger.js";

import { fileURLToPath } from "url";
import { ConsoleLogger } from "../src/logger.js";
import { Readme } from "../src/readme.js";
import { Tag } from "../src/tag.js";
import { SpecModel } from "../src/spec-model.js";
import { ConsoleLogger } from "../src/logger.js";
import { Tag } from "../src/tag.js";

const __dirname = dirname(fileURLToPath(import.meta.url));

Expand Down Expand Up @@ -51,6 +51,26 @@
);
});

it("returns examples", async () => {
const swagger = new Swagger(resolve(__dirname, "fixtures/swagger/ignoreExamples/swagger.json"));
const examples = await swagger.getExamples();

const expectedExamplePath = resolve(
__dirname,
"fixtures/swagger/ignoreExamples/examples/example.json",
);
expect(examples).toMatchObject(
new Map([
[
expectedExamplePath,
expect.objectContaining({
path: expect.stringContaining(expectedExamplePath),
}),
],
]),
);
});

describe("getOperations", () => {
it("should return normal operations", async () => {
const testFixturePath = join(__dirname, "fixtures", "swagger", "specification");
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/arm-auto-signoff.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: ARM Auto SignOff

on:
Expand All @@ -16,25 +16,6 @@
workflow_run:
workflows: ["ARM Incremental TypeSpec"]
types: [completed]
# For manual testing
workflow_dispatch:
inputs:
owner:
description: The account owner of the repository. The name is not case sensitive.
required: true
type: string
repo:
description: The name of the repository without the .git extension. The name is not case sensitive.
required: true
type: string
issue_number:
description: The number of the pull request.
required: true
type: string
head_sha:
description: The SHA of the commit.
required: true
type: string

permissions:
actions: read
Expand All @@ -51,7 +32,6 @@
# issue_comment:edited - filter to only PR comments containing "next steps to merge",
# a signal that checks like "Swagger LintDiff" or "Swagger Avocado" status may have changed
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_run' ||
(github.event_name == 'pull_request_target' &&
(github.event.action == 'labeled' ||
Expand Down Expand Up @@ -96,11 +76,6 @@
const { default: getLabelAction } =
await import('${{ github.workspace }}/.github/workflows/src/arm-auto-signoff.js');
return await getLabelAction({ github, context, core });
env:
OWNER: ${{ inputs.owner }}
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
HEAD_SHA: ${{ inputs.head_sha }}

- if: |
fromJson(steps.get-label-action.outputs.result).labelAction == 'add' ||
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/src/arm-auto-signoff.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @ts-check

import { setEquals } from "../../shared/src/equality.js";
Expand All @@ -12,18 +12,7 @@
* @returns {Promise<{labelAction: LabelAction, issueNumber: number}>}
*/
export default async function getLabelAction({ github, context, core }) {
let owner = process.env.OWNER || "";
let repo = process.env.REPO || "";
let issue_number = parseInt(process.env.ISSUE_NUMBER || "");
let head_sha = process.env.HEAD_SHA || "";

if (!owner || !repo || !issue_number || !head_sha) {
let inputs = await extractInputs(github, context, core);
owner = owner || inputs.owner;
repo = repo || inputs.repo;
issue_number = issue_number || inputs.issue_number;
head_sha = head_sha || inputs.head_sha;
}
const { owner, repo, issue_number, head_sha } = await extractInputs(github, context, core);

return await getLabelActionImpl({
owner,
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/src/update-labels.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @ts-check

import { extractInputs } from "../src/context.js";
Expand All @@ -7,19 +7,7 @@
* @param {import('@actions/github-script').AsyncFunctionArguments} AsyncFunctionArguments
*/
export default async function updateLabels({ github, context, core }) {
let owner = process.env.OWNER;
let repo = process.env.REPO;
let issue_number = parseInt(process.env.ISSUE_NUMBER || "");
let run_id = parseInt(process.env.RUN_ID || "");

if (!owner || !repo || !(issue_number || run_id)) {
let inputs = await extractInputs(github, context, core);
owner = owner || inputs.owner;
repo = repo || inputs.repo;
issue_number = issue_number || inputs.issue_number;
run_id = run_id || inputs.run_id;
}

const { owner, repo, issue_number, run_id } = await extractInputs(github, context, core);
await updateLabelsImpl({ owner, repo, issue_number, run_id, github, core });
}

Expand Down
101 changes: 0 additions & 101 deletions .github/workflows/test/update-labels.test.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,9 @@
import { describe, expect, it } from "vitest";
import { PER_PAGE_MAX } from "../src/github.js";
import updateLabels, { updateLabelsImpl } from "../src/update-labels.js";
import { createMockCore, createMockGithub, createMockRequestError } from "./mocks.js";

describe("updateLabels", () => {
it("loads inputs from env", async () => {
const github = createMockGithub();
github.rest.actions.listWorkflowRunArtifacts.mockResolvedValue({
data: {
artifacts: [{ name: "label-foo=true" }],
},
});

try {
process.env.OWNER = "TestRepoOwnerLoginEnv";
process.env.REPO = "TestRepoNameEnv";
process.env.ISSUE_NUMBER = "123";
process.env.RUN_ID = "456";

await expect(
updateLabels({
github: github,
context: null,
core: createMockCore(),
}),
).resolves.toBeUndefined();
} finally {
delete process.env.OWNER;
delete process.env.REPO;
delete process.env.ISSUE_NUMBER;
delete process.env.RUN_ID;
}

expect(github.rest.actions.listWorkflowRunArtifacts).toBeCalledWith({
owner: "TestRepoOwnerLoginEnv",
repo: "TestRepoNameEnv",
run_id: 456,
per_page: PER_PAGE_MAX,
});
expect(github.rest.issues.addLabels).toBeCalledWith({
owner: "TestRepoOwnerLoginEnv",
repo: "TestRepoNameEnv",
issue_number: 123,
labels: ["foo"],
});
expect(github.rest.issues.removeLabel).toBeCalledTimes(0);
});

it("loads inputs from context", async () => {
const github = createMockGithub();
github.rest.actions.listWorkflowRunArtifacts.mockResolvedValue({
Expand Down Expand Up @@ -96,64 +53,6 @@
});
expect(github.rest.issues.removeLabel).toBeCalledTimes(0);
});

it("loads inputs from env and context", async () => {
const github = createMockGithub();
github.rest.actions.listWorkflowRunArtifacts.mockResolvedValue({
data: {
artifacts: [{ name: "label-foo=true" }],
},
});

const context = {
eventName: "workflow_run",
payload: {
action: "completed",
workflow_run: {
event: "pull_request",
head_sha: "abc123",
id: 456,
repository: {
name: "TestRepoName",
owner: {
login: "TestRepoOwnerLogin",
},
},
pull_requests: [{ number: 123 }],
},
},
};

try {
process.env.OWNER = "TestRepoOwnerLoginEnv";
process.env.REPO = "TestRepoNameEnv";

await expect(
updateLabels({
github: github,
context: context,
core: createMockCore(),
}),
).resolves.toBeUndefined();
} finally {
delete process.env.OWNER;
delete process.env.REPO;
}

expect(github.rest.actions.listWorkflowRunArtifacts).toBeCalledWith({
owner: "TestRepoOwnerLoginEnv",
repo: "TestRepoNameEnv",
run_id: 456,
per_page: PER_PAGE_MAX,
});
expect(github.rest.issues.addLabels).toBeCalledWith({
owner: "TestRepoOwnerLoginEnv",
repo: "TestRepoNameEnv",
issue_number: 123,
labels: ["foo"],
});
expect(github.rest.issues.removeLabel).toBeCalledTimes(0);
});
});

describe("updateLabelsImpl", () => {
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/update-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: Update Labels

on:
Expand All @@ -9,26 +9,6 @@
workflows:
["ARM Auto SignOff", "SDK Breaking Change Labels", "SDK Suppressions", "TypeSpec Requirement"]
types: [completed]
workflow_dispatch:
inputs:
owner:
description: The account owner of the repository. The name is not case sensitive.
required: true
type: string
repo:
description: The name of the repository without the .git extension. The name is not case sensitive.
required: true
type: string
# simulate pull_request trigger
issue_number:
description: The number that identifies the issue.
required: false
type: number
# simulate workflow_run trigger
run_id:
description: The unique identifier of the workflow run.
required: false
type: number

permissions:
actions: read
Expand All @@ -52,11 +32,6 @@

- name: Update Labels
uses: actions/github-script@v7
env:
OWNER: ${{ inputs.owner }}
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
RUN_ID: ${{ inputs.run_id }}
with:
script: |
const { default: updateLabels } =
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

Loading
Loading