Skip to content

Commit

Permalink
Update tspconfig for data-plane (#4869)
Browse files Browse the repository at this point in the history
Update data-plane tspconfig to comply with the azure-rest-spec repo
requirements

fixes #4787 4787
  • Loading branch information
joheredi authored Jan 25, 2024
1 parent 27490ae commit 4e0feaf
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@autorest/openapi-to-typespec",
"comment": "Improve data-plane tspconfig",
"type": "patch"
}
],
"packageName": "@autorest/openapi-to-typespec"
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import { pascalCase } from "@azure-tools/codegen";
import { TypespecProgram } from "interfaces";
import { getSession } from "../autorest-session";
import { getOptions } from "../options";
import { formatFile } from "../utils/format";

export async function emitTypespecConfig(filePath: string): Promise<void> {
export async function emitTypespecConfig(filePath: string, programDetails: TypespecProgram): Promise<void> {
const session = getSession();
const { isArm } = getOptions();
let content = `emit:
- "@azure-tools/typespec-autorest"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
# "package-version":
# "package-name":
# "output-path":
# Uncomment this line and add "@azure-tools/typespec-java" to your package.json to generate Java code
# "@azure-tools/typespec-java": true
# Uncomment this line and add "@azure-tools/typespec-csharp" to your package.json to generate C# code
# "@azure-tools/typespec-csharp": true
# Uncomment this line and add "@azure-tools/typespec-ts" to your package.json to generate Typescript code
# "@azure-tools/typespec-ts": true
let content = `
emit:
- "@azure-tools/typespec-autorest"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
# "package-version":
# "package-name":
# "output-path":
# Uncomment this line and add "@azure-tools/typespec-java" to your package.json to generate Java code
# "@azure-tools/typespec-java": true
# Uncomment this line and add "@azure-tools/typespec-csharp" to your package.json to generate C# code
# "@azure-tools/typespec-csharp": true
# Uncomment this line and add "@azure-tools/typespec-ts" to your package.json to generate Typescript code
# "@azure-tools/typespec-ts": true
`;

if (isArm) {
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/openapi-to-typespec/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function processConverter(host: AutorestExtensionHost) {
await emitRoutes(getFilePath(session, "routes.tsp"), programDetails);
await emitMain(getFilePath(session, "main.tsp"), programDetails);
await emitPackage(getFilePath(session, "package.json"), programDetails);
await emitTypespecConfig(getFilePath(session, "tspconfig.yaml"));
await emitTypespecConfig(getFilePath(session, "tspconfig.yaml"), programDetails);
}

function getOutuptDirectory(session: Session<CodeModel>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
emit:
- "@azure-tools/typespec-autorest"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: "{project-root}/examples"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
Expand Down

0 comments on commit 4e0feaf

Please sign in to comment.