Skip to content

Commit

Permalink
specs, scenario for clientNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft committed Nov 20, 2024
1 parent 7719b7a commit fe20868
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using TypeSpec.Http;
using global.Azure.ClientGenerator.Core;
using _Specs_.Azure.ClientGenerator.Core.ClientNamespace;

@scenario
@scenarioDoc("""
Expected client namespace for clients:
- ClientNamespaceFirstClient: Azure.ClientGenerator.Core.ClientNamespace
- ClientNamespaceSecondClient: Azure.ClientGenerator.Core.ClientNamespace.Second

Expected client namespace for models:
- FirstClientResult: Azure.ClientGenerator.Core.ClientNamespace.First
- SecondClientResult: Azure.ClientGenerator.Core.ClientNamespace.Second
- SecondClientEnumType: Azure.ClientGenerator.Core.ClientNamespace.Second.Sub
""")
namespace Client;

@client({
name: "ClientNamespaceFirstClient",
service: _Specs_.Azure.ClientGenerator.Core.ClientNamespace,
})
@clientNamespace("azure.clientgenerator.core.clientnamespace", "java")
interface ClientNamespaceFirstClient {
get is First.get;
}
@@clientNamespace(FirstModel, "azure.clientgenerator.core.clientnamespace.firstt", "java");

@client({
name: "ClientNamespaceSecondClient",
service: _Specs_.Azure.ClientGenerator.Core.ClientNamespace,
})
@clientNamespace("azure.clientgenerator.core.clientnamespace.second", "java")
namespace ClientNamespaceSecondClient {
op get is _Specs_.Azure.ClientGenerator.Core.ClientNamespace.Second.get;
}
@@clientNamespace(Second.Model, "azure.clientgenerator.core.clientnamespace.second", "java");
@@clientNamespace(Second.Model.SecondClientEnumType, "azure.clientgenerator.core.clientnamespace.second.sub", "java");
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import "@typespec/http";
import "@azure-tools/cadl-ranch-expect";

using TypeSpec.Http;

/** Illustrates the clientNamespace cases. */
@scenarioService("/azure/client-generator-core/client-namespace")
namespace _Specs_.Azure.ClientGenerator.Core.ClientNamespace;

interface First {
#suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp"
@route("/first")
@get
get(): FirstModel.FirstClientResult;
}

namespace FirstModel {
model FirstClientResult {
name: string;
}
}

namespace Second {
#suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp"
@route("/second")
@get
op get(): Model.SecondClientResult;

namespace Model {
model SecondClientResult {
type: SecondClientEnumType;
}

union SecondClientEnumType {
string,
"type",
}
}
}

0 comments on commit fe20868

Please sign in to comment.