Skip to content

Commit

Permalink
http-client-java, do not prefix com. in namespace (#5084)
Browse files Browse the repository at this point in the history
Also remove the `Cadl.` in local test. Replaced it with `TspTest` (we
don't want to call it `TypeSpec.` as it could conflict with TypeSpec
libs).

It would not affect Azure SDK which always has `namespace` in emitter
option.
It only affect SDK that does not have this option (basically, test case,
and unbranded).

It prepares for the Namespace refactor, as we should not modify the
TypeSpec Namespace. Azure/autorest.java#2968
  • Loading branch information
weidongxu-microsoft authored Nov 13, 2024
1 parent 346929e commit 56349a5
Show file tree
Hide file tree
Showing 3,279 changed files with 111,423 additions and 111,313 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,7 @@ export class CodeModelBuilder {
) {
return baseJavaNamespace + namespace.slice(tspNamespace.length).toLowerCase();
} else {
return "com." + namespace.toLowerCase();
return namespace.toLowerCase();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ $generateScript = {
$tspOptions = "--option ""@typespec/http-client-java.emitter-output-dir={project-root}/tsp-output/$(Get-Random)"""
if ($tspFile -match "type[\\/]enum[\\/]extensible[\\/]") {
# override namespace for reserved keyword "enum"
$tspOptions += " --option ""@typespec/http-client-java.namespace=com.type.enums.extensible"""
$tspOptions += " --option ""@typespec/http-client-java.namespace=type.enums.extensible"""
} elseif ($tspFile -match "type[\\/]enum[\\/]fixed[\\/]") {
# override namespace for reserved keyword "enum"
$tspOptions += " --option ""@typespec/http-client-java.namespace=com.type.enums.fixed"""
$tspOptions += " --option ""@typespec/http-client-java.namespace=type.enums.fixed"""
} elseif ($tspFile -match "azure[\\/]example[\\/]basic[\\/]") {
# override examples-directory
$tspOptions += " --option ""@typespec/http-client-java.examples-directory={project-root}/http/azure/example/basic/examples"""
} elseif ($tspFile -match "resiliency[\\/]srv-driven[\\/]old\.tsp") {
# override namespace for "resiliency/srv-driven/old.tsp" (make it different to that from "main.tsp")
$tspOptions += " --option ""@typespec/http-client-java.namespace=com.resiliency.servicedriven.v1"""
$tspOptions += " --option ""@typespec/http-client-java.namespace=resiliency.servicedriven.v1"""
# enable advanced versioning for resiliency test
$tspOptions += " --option ""@typespec/http-client-java.advanced-versioning=true"""
$tspOptions += " --option ""@typespec/http-client-java.api-version=all"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CustomizationTest extends Customization {
@Override
public void customize(LibraryCustomization customization, Logger logger) {
logger.info("Customizing the NamingClient javadoc");
PackageCustomization packageCustomization = customization.getPackage("com.cadl.naming");
PackageCustomization packageCustomization = customization.getPackage("tsptest.naming");
ClassCustomization classCustomization = packageCustomization.getClass("NamingClient");
classCustomization.getMethod("postWithResponse")
.getJavadoc()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.AccessClientImpl;
import _specs_.azure.clientgenerator.core.access.implementation.AccessClientImpl;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ServiceClientBuilder;
import com.azure.core.client.traits.ConfigurationTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.InternalOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.implementation.models.InternalDecoratorModelInInternal;
import com._specs_.azure.clientgenerator.core.access.implementation.models.NoDecoratorModelInInternal;
import com._specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.implementation.InternalOperationsImpl;
import _specs_.azure.clientgenerator.core.access.implementation.models.InternalDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.implementation.models.NoDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInInternal;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.InternalOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.implementation.models.InternalDecoratorModelInInternal;
import com._specs_.azure.clientgenerator.core.access.implementation.models.NoDecoratorModelInInternal;
import com._specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.implementation.InternalOperationsImpl;
import _specs_.azure.clientgenerator.core.access.implementation.models.InternalDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.implementation.models.NoDecoratorModelInInternal;
import _specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInInternal;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.PublicOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.models.NoDecoratorModelInPublic;
import com._specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInPublic;
import _specs_.azure.clientgenerator.core.access.implementation.PublicOperationsImpl;
import _specs_.azure.clientgenerator.core.access.models.NoDecoratorModelInPublic;
import _specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInPublic;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.PublicOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.models.NoDecoratorModelInPublic;
import com._specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInPublic;
import _specs_.azure.clientgenerator.core.access.implementation.PublicOperationsImpl;
import _specs_.azure.clientgenerator.core.access.models.NoDecoratorModelInPublic;
import _specs_.azure.clientgenerator.core.access.models.PublicDecoratorModelInPublic;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.implementation.models.AbstractModel;
import com._specs_.azure.clientgenerator.core.access.implementation.models.OuterModel;
import _specs_.azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl;
import _specs_.azure.clientgenerator.core.access.implementation.models.AbstractModel;
import _specs_.azure.clientgenerator.core.access.implementation.models.OuterModel;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.implementation.models.AbstractModel;
import com._specs_.azure.clientgenerator.core.access.implementation.models.OuterModel;
import _specs_.azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl;
import _specs_.azure.clientgenerator.core.access.implementation.models.AbstractModel;
import _specs_.azure.clientgenerator.core.access.implementation.models.OuterModel;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.models.SharedModel;
import _specs_.azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl;
import _specs_.azure.clientgenerator.core.access.models.SharedModel;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access;
package _specs_.azure.clientgenerator.core.access;

import com._specs_.azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl;
import com._specs_.azure.clientgenerator.core.access.models.SharedModel;
import _specs_.azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl;
import _specs_.azure.clientgenerator.core.access.models.SharedModel;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation;
package _specs_.azure.clientgenerator.core.access.implementation;

import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation;
package _specs_.azure.clientgenerator.core.access.implementation;

import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation;
package _specs_.azure.clientgenerator.core.access.implementation;

import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation;
package _specs_.azure.clientgenerator.core.access.implementation;

import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation;
package _specs_.azure.clientgenerator.core.access.implementation;

import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* Used in internal operations, should be generated but not exported.
*/
@Immutable
public final class InnerModel implements JsonSerializable<InnerModel> {
/*
* The name property.
*/
@Generated
private final String name;

/**
* Creates an instance of InnerModel class.
*
* @param name the name value to set.
*/
@Generated
private InnerModel(String name) {
this.name = name;
}

/**
* Get the name property: The name property.
*
* @return the name value.
*/
@Generated
public String getName() {
return this.name;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of InnerModel from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing
* to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the InnerModel.
*/
@Generated
public static InnerModel fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String name = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("name".equals(fieldName)) {
name = reader.getString();
} else {
reader.skipChildren();
}
}
return new InnerModel(name);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.implementation.models;
package _specs_.azure.clientgenerator.core.access.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

/**
* <!-- start generated doc -->
* Package containing the data models for Access.
* Test for internal decorator.
* <!-- end generated doc -->
*/
package _specs_.azure.clientgenerator.core.access.implementation.models;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

/**
* <!-- start generated doc -->
* Package containing the implementations for Access.
* Test for internal decorator.
* <!-- end generated doc -->
*/
package _specs_.azure.clientgenerator.core.access.implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com._specs_.azure.clientgenerator.core.access.models;
package _specs_.azure.clientgenerator.core.access.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
Expand Down
Loading

0 comments on commit 56349a5

Please sign in to comment.