Skip to content

Commit

Permalink
fix(csharp): Default forward compatible enums to false
Browse files Browse the repository at this point in the history
  • Loading branch information
Swimburger committed Oct 2, 2024
1 parent cdbe81d commit 427e2e4
Show file tree
Hide file tree
Showing 383 changed files with 7,512 additions and 6,465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const BaseCsharpCustomConfigSchema = z.object({
namespace: z.string().optional(),
"simplify-object-dictionaries": z.boolean().optional(),
"read-only-memory-types": z.optional(z.array(z.string())),
"forward-compatible-enums": z.boolean().optional(),
"enable-forward-compatible-enums": z.boolean().optional(),
"package-id": z.string().optional()
});

Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/model/src/ModelGeneratorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ModelGeneratorContext extends AbstractCsharpGeneratorContext<ModelC
AsIsFiles.JsonConfiguration,
AsIsFiles.OneOfSerializer
];
if (this.customConfig["enable-forward-compatible-enums"] ?? true) {
if (this.customConfig["enable-forward-compatible-enums"] ?? false) {
files.push(AsIsFiles.StringEnum);
files.push(AsIsFiles.StringEnumSerializer);
} else {
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/model/src/generateModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function generateModels({ context }: { context: ModelGeneratorContext }):
const file = typeDeclaration.shape._visit<CSharpFile | undefined>({
alias: () => undefined,
enum: (etd: EnumTypeDeclaration) => {
return context.customConfig["enable-forward-compatible-enums"] ?? true
return context.customConfig["enable-forward-compatible-enums"] ?? false
? new StringEnumGenerator(context, typeDeclaration, etd).generate()
: new EnumGenerator(context, typeDeclaration, etd).generate();
},
Expand Down
18 changes: 12 additions & 6 deletions generators/csharp/model/versions.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
- version: 1.0.0
# - version: 1.0.0
# createdAt: '2024-10-02'
# changelogEntry:
# - type: break
# summary: >-
# The C# SDK now uses forward compatible enums which are not compatible with the previously generated enums.
# Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
# irVersion: 33
- version: 0.1.0
createdAt: '2024-10-02'
changelogEntry:
- type: break
summary: >-
The C# SDK now uses forward compatible enums which are not compatible with the previously generated enums.
Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
- type: feat
summary: Add forward compatible enums
summary: >-
Add forward compatible enums.
Set `enable-forward-compatible-enums` to `true` in the configuration to generate forward compatible enums.
irVersion: 33
- version: 0.0.1
createdAt: '2024-03-31'
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/sdk/src/SdkGeneratorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class SdkGeneratorContext extends AbstractCsharpGeneratorContext<SdkCusto
if (this.hasGrpcEndpoints()) {
files.push(AsIsFiles.RawGrpcClient);
}
if (this.customConfig["enable-forward-compatible-enums"] ?? true) {
if (this.customConfig["enable-forward-compatible-enums"] ?? false) {
files.push(AsIsFiles.StringEnum);
files.push(AsIsFiles.StringEnumSerializer);
} else {
Expand Down
17 changes: 11 additions & 6 deletions generators/csharp/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
- version: 2.0.0
# - version: 2.0.0
# createdAt: '2024-10-02'
# changelogEntry:
# - type: break
# summary: >-
# The C# SDK now uses forward compatible enums which are not compatible with the previously generated enums.
# Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
- version: 1.8.0
createdAt: '2024-10-02'
changelogEntry:
- type: break
summary: >-
The C# SDK now uses forward compatible enums which are not compatible with the previously generated enums.
Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
- type: feat
summary: Add forward compatible enums
summary: >-
Add forward compatible enums.
Set `enable-forward-compatible-enums` to `true` in the configuration to generate forward compatible enums.
- version: 1.7.0
createdAt: '2024-08-29'
changelogEntry:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

53 changes: 53 additions & 0 deletions seed/csharp-model/alias/src/SeedAlias/Core/EnumSerializer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions seed/csharp-model/alias/src/SeedAlias/Core/StringEnum.cs

This file was deleted.

26 changes: 0 additions & 26 deletions seed/csharp-model/alias/src/SeedAlias/Core/StringEnumSerializer.cs

This file was deleted.

53 changes: 53 additions & 0 deletions seed/csharp-model/any-auth/src/SeedAnyAuth/Core/EnumSerializer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions seed/csharp-model/any-auth/src/SeedAnyAuth/Core/StringEnum.cs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 427e2e4

Please sign in to comment.