Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion powershell/llcsharp/model/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ export class NewModelInterface extends Interface implements NewEnhancedTypeDecla
inherited: [],
inlined: []
};
// skip-for-time-being
if (this.schema.language.csharp.virtualProperties) {

for (const virtualProperty of values(virtualProperties.owned)) {
Expand Down
2 changes: 1 addition & 1 deletion powershell/llcsharp/model/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class NewModelProperty extends BackedProperty implements EnhancedVariable
this.apply(objectInitializer);
this.description = description;
this.required = isRequired;
if ((this.schema.type === SchemaType.Object || this.schema.type === SchemaType.Dictionary) && isAnExpression(this.get) && schema.language.csharp?.classImplementation) {
if ((this.schema.type === SchemaType.Object || this.schema.type === SchemaType.Dictionary || this.schema.type === SchemaType.Any) && isAnExpression(this.get) && schema.language.csharp?.classImplementation) {
// for objects, the getter should auto-create a new object
this.get = toExpression(`(${this.get.value} = ${this.get.value} ?? new ${schema.language.csharp?.fullname}())`);
}
Expand Down
4 changes: 0 additions & 4 deletions powershell/models/model-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ export class NewModelExtensionsNamespace extends Namespace {

// Add typeconverters to model classes (partial)
for (const schemaGroup of values(schemas)) {
if (schemaGroup.length > 0 && (schemaGroup[0].type === SchemaType.Any)) {
// skip any
continue;
}
for (const schema of values(schemaGroup)) {
if (!schema || (schema.language.csharp && schema.language.csharp.skip)) {
continue;
Expand Down
9 changes: 6 additions & 3 deletions powershell/plugins/cs-namer-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function setPropertyNames(schema: Schema) {
return;
}
for (const propertySchema of values(schema.properties)) {
if (propertySchema.schema.type === SchemaType.Any) {
continue;
}
const propertyDetails = propertySchema.language.default;
propertyDetails.required = propertySchema.required ?? false;
propertyDetails.readOnly = propertySchema.readOnly ?? false;
Expand Down Expand Up @@ -95,7 +98,7 @@ function setSchemaNames(schemaGroups: Dictionary<Array<Schema>>, azure: boolean,
thisNamespace.add(schemaName);

// object types.
if (schema.type === SchemaType.Object || schema.type === SchemaType.Dictionary) {
if (schema.type === SchemaType.Object || schema.type === SchemaType.Dictionary || schema.type === SchemaType.Any) {
schema.language.csharp = {
...details,
apiversion: thisApiversion,
Expand Down Expand Up @@ -164,7 +167,7 @@ async function setOperationNames(state: State, resolver: NewSchemaDefinitionReso
const details = operation.language.default;

// come up with a name
const oName = getPascalIdentifier(details.name);
const oName = getPascalIdentifier(operationGroup.$key + '_' + details.name);
let i = 1;
let operationName = oName;
while (operationNames.has(operationName)) {
Expand All @@ -175,7 +178,7 @@ async function setOperationNames(state: State, resolver: NewSchemaDefinitionReso

operation.language.csharp = {
...details, // inherit
name: getPascalIdentifier(operationGroup.language.default.name + '_' + operationName),
name: getPascalIdentifier(operationName),
};

// parameters are camelCased.
Expand Down
4 changes: 2 additions & 2 deletions powershell/plugins/plugin-tweak-m4-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ function addDictionaryApiVersion(model: CodeModel) {
}

for (const prop of getAllProperties(schema)) {
if (prop.schema.type !== SchemaType.Dictionary || prop.schema.apiVersions) {
if ((prop.schema.type !== SchemaType.Dictionary && prop.schema.type !== SchemaType.Any) || prop.schema.apiVersions) {
continue;
}
const dictSchema = prop.schema as DictionarySchema;
const dictSchema = prop.schema;
dictSchema.apiVersions = JSON.parse(JSON.stringify(schema.apiVersions));
}
})
Expand Down
Loading