Skip to content

Commit 00fb035

Browse files
http-client-java, populate title in settings (#8755)
For the split of containerregistry. We'd use the `title` to distinguish containerregistry with containerregistrytasks This should work both in Swagger and in TypeSpec (local test latter).
1 parent 667c58e commit 00fb035

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/examplemodel/FluentClientMethodExample.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public String getMethodReference() {
107107
// OpenAPI source of deployments moved to a separate folder
108108
serviceClientReference = "deploymentClient()";
109109
}
110+
} else if ("containerregistry".equals(lastIdentifier)) {
111+
String title = settings.getAutorestSettings().getTitle();
112+
if ("ContainerRegistryTasks".equals(title)) {
113+
serviceClientReference = "taskClient()";
114+
}
110115
}
111116

112117
String methodGroupReference = "get" + CodeNamer.toPascalCase(methodGroup.getVariableName()) + "()";

packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public static void main(String[] args) throws IOException {
106106

107107
private static void handleFluent(CodeModel codeModel, EmitterOptions emitterOptions, boolean sdkIntegration) {
108108
// initialize plugin
109-
TypeSpecFluentPlugin fluentPlugin = new TypeSpecFluentPlugin(emitterOptions, sdkIntegration);
109+
TypeSpecFluentPlugin fluentPlugin
110+
= new TypeSpecFluentPlugin(emitterOptions, sdkIntegration, codeModel.getInfo().getTitle());
110111

111112
codeModel = fluentPlugin.preProcess(codeModel);
112113

packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/fluent/TypeSpecFluentPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ public class TypeSpecFluentPlugin extends FluentGen {
3838
private static final Logger LOGGER = LoggerFactory.getLogger(TypeSpecFluentPlugin.class);
3939
private final EmitterOptions emitterOptions;
4040

41-
public TypeSpecFluentPlugin(EmitterOptions options, boolean sdkIntegration) {
41+
public TypeSpecFluentPlugin(EmitterOptions options, boolean sdkIntegration, String title) {
4242
super(new TypeSpecPlugin.MockConnection(), "dummy", "dummy");
4343
this.emitterOptions = options;
4444

45+
SETTINGS_MAP.put("title", title);
4546
SETTINGS_MAP.put("namespace", options.getNamespace());
4647
if (!CoreUtils.isNullOrEmpty(options.getOutputDir())) {
4748
SETTINGS_MAP.put("output-folder", options.getOutputDir());

0 commit comments

Comments
 (0)