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

support-arm-id-schema #1697

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 18 additions & 7 deletions packages/autorest.typescript/src/transforms/mapperTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ function buildMapper(
const serializedName =
getDiscriminatorValue(schema) ||
options.serializedName ||
(schema as ObjectSchema).discriminator && !isUberParent(schema as ObjectSchema) && getLanguageMetadata(schema.language).name ||
((schema as ObjectSchema).discriminator &&
!isUberParent(schema as ObjectSchema) &&
getLanguageMetadata(schema.language).name) ||
// Fallback to name only for XML schemas since they need a name, otherwise don't
(options.hasXmlMetadata && getLanguageMetadata(schema.language).name);

Expand Down Expand Up @@ -297,10 +299,10 @@ function buildAdditionalProperties(
const additionalProperties = getAdditionalProperties(objectSchema);
return additionalProperties
? {
type: {
name: MapperType.Object
type: {
name: MapperType.Object
}
}
}
: undefined;
}

Expand Down Expand Up @@ -350,7 +352,9 @@ function transformObjectMapper(pipelineValue: PipelineValue) {
);

if (objectSchema.parents?.immediate[0]) {
uberParent = getMapperClassName(objectSchema.parents?.immediate[0] as ObjectSchema);
uberParent = getMapperClassName(
objectSchema.parents?.immediate[0] as ObjectSchema
);
}
const mapper = buildMapper(
schema,
Expand Down Expand Up @@ -593,7 +597,12 @@ function transformStringMapper(pipelineValue: PipelineValue) {
*/
if (
!isSchemaType(
[SchemaType.String, SchemaType.Credential, SchemaType.Uri],
[
SchemaType.String,
SchemaType.Credential,
SchemaType.Uri,
SchemaType.ArmId
],
schema
)
) {
Expand Down Expand Up @@ -697,7 +706,9 @@ function processProperties(
const propName = getLanguageMetadata(prop.language).name;
const name = normalizeName(
propName,
prop.language.default.isTopLevelParameter ? NameType.Parameter : NameType.Property,
prop.language.default.isTopLevelParameter
? NameType.Parameter
: NameType.Property,
true /** shouldGuard */
);
modelProperties[name] = getMapperOrRef(prop.schema, serializedName, {
Expand Down
1 change: 1 addition & 0 deletions packages/autorest.typescript/src/utils/schemaHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export function getTypeForSchema(
case SchemaType.Uuid:
case SchemaType.Uri:
case SchemaType.Credential:
case SchemaType.ArmId:
typeName = "string";
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const readmes: SpecDefinition[] = [
AutorestParams.AzureSdkForJs,
AutorestParams.AzureArm
],
branch: "925e8285703ddd461588d8f5fbf14bd97c286fab",
branch: "25bea13c86145a7620e363826a9ae476c18adb5f",
buildTag: "ci_3"
},
{
Expand Down
Loading