-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7719b7a
commit fe20868
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/cadl-ranch-specs/http/azure/client-generator-core/client-namespace/client.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
39 changes: 39 additions & 0 deletions
39
packages/cadl-ranch-specs/http/azure/client-generator-core/client-namespace/main.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} | ||
} | ||
} |