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

Add mobo to TypeSpec-Azure common types #1482

Merged
merged 10 commits into from
Sep 6, 2024
1 change: 1 addition & 0 deletions packages/samples/common-types/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ await emitCommonTypesSwagger("customer-managed-keys");
await emitCommonTypesSwagger("managed-identity");
await emitCommonTypesSwagger("private-links");
await emitCommonTypesSwagger("types");
await emitCommonTypesSwagger("mobo");

function log(...args: any[]) {
// eslint-disable-next-line no-console
Expand Down
37 changes: 37 additions & 0 deletions packages/samples/common-types/openapi/v5/mobo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"swagger": "2.0",
"info": {
"title": "Common types",
"version": "v5"
},
"paths": {},
"definitions": {
"ManagedOnBehalfOfConfiguration": {
"type": "object",
"description": "Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider manages those resources on behalf of the resource owner.",
"properties": {
"moboBrokerResources": {
"type": "array",
"description": "Managed-On-Behalf-Of broker resources",
"items": {
"$ref": "#/definitions/MoboBrokerResource"
},
"x-ms-identifiers": [
"id"
]
}
}
},
"MoboBrokerResource": {
"type": "object",
"description": "Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on behalf of the user.",
"properties": {
"id": {
"type": "string",
"format": "arm-id",
"description": "Resource identifier of a Managed-On-Behalf-Of broker resource"
}
}
}
}
}
9 changes: 9 additions & 0 deletions packages/samples/common-types/src/mobo.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./base.tsp";

import "../../node_modules/@azure-tools/typespec-azure-resource-manager/lib/common-types/mobo.tsp";

using OpenAPI;

namespace Azure.ResourceManager.CommonTypes;

@@extension(ManagedOnBehalfOfConfiguration.moboBrokerResources, "x-ms-identifiers", ["id"]);
AlitzelMendez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Azure.Core;
using TypeSpec.Versioning;

namespace Azure.ResourceManager.CommonTypes;

/** Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider manages those resources on behalf of the resource owner. */
@added(Versions.v5)
model ManagedOnBehalfOfConfiguration {
/** Managed-On-Behalf-Of broker resources */
moboBrokerResources?: MoboBrokerResource[];
}

/** Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on behalf of the user. */
@added(Versions.v5)
model MoboBrokerResource {
/** Resource identifier of a Managed-On-Behalf-Of broker resource */
@format("arm-id")
id?: string;
AlitzelMendez marked this conversation as resolved.
Show resolved Hide resolved
}
Loading