Skip to content

Commit f3ada9b

Browse files
committed
Add the documentation stuff properly
1 parent 93d44fb commit f3ada9b

6 files changed

Lines changed: 17 additions & 5 deletions

File tree

docs/generators/aspnet-fastendpoints.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
4242

4343
| Extension name | Description | Applicable for | Default value |
4444
| -------------- | ----------- | -------------- | ------------- |
45-
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used. Zero-based.|MODEL|false
45+
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used, zero-based|MODEL|false
46+
4647

4748
## IMPORT MAPPING
4849

docs/generators/aspnetcore.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6060

6161
| Extension name | Description | Applicable for | Default value |
6262
| -------------- | ----------- | -------------- | ------------- |
63-
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used. Zero-based.|MODEL|false
63+
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used, zero-based|MODEL|false
64+
6465

6566
## IMPORT MAPPING
6667

docs/generators/csharp-functions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
5252

5353
| Extension name | Description | Applicable for | Default value |
5454
| -------------- | ----------- | -------------- | ------------- |
55-
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used. Zero-based.|MODEL|false
55+
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used, zero-based|MODEL|false
56+
5657

5758
## IMPORT MAPPING
5859

docs/generators/csharp.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6161

6262
| Extension name | Description | Applicable for | Default value |
6363
| -------------- | ----------- | -------------- | ------------- |
64-
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used. Zero-based.|MODEL|false
64+
|x-zero-based-enum|When used on an enum, the index will not be generated and the default numbering will be used, zero-based|MODEL|false
65+
6566

6667
## IMPORT MAPPING
6768

modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public enum VendorExtension {
2424
X_OPERATION_EXTRA_ANNOTATION("x-operation-extra-annotation", ExtensionLevel.OPERATION, "List of custom annotations to be added to operation", null),
2525
X_VERSION_PARAM("x-version-param", ExtensionLevel.OPERATION_PARAMETER, "Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false", null),
2626
X_PATTERN_MESSAGE("x-pattern-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null),
27+
X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false"),
2728
;
2829

2930
private final String name;

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
105105
protected boolean supportNullable = Boolean.FALSE;
106106

107107
@Setter protected Boolean zeroBasedEnums = null;
108-
protected static final String zeroBasedEnumVendorExtension = "x-zero-based-enum";
108+
protected static final String zeroBasedEnumVendorExtension = VendorExtension.X_ZERO_BASED_ENUM.getName();
109109

110110
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
111111

@@ -2033,6 +2033,13 @@ protected Set<String> getNullableTypes() {
20332033
throw new RuntimeException("This method should no longer be used.");
20342034
}
20352035

2036+
@Override
2037+
public List<VendorExtension> getSupportedVendorExtensions() {
2038+
List<VendorExtension> extensions = super.getSupportedVendorExtensions();
2039+
extensions.add(VendorExtension.X_ZERO_BASED_ENUM);
2040+
return extensions;
2041+
}
2042+
20362043
protected Set<String> getValueTypes() {
20372044
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateOnly", "DateTimeOffset", "Guid"));
20382045
}

0 commit comments

Comments
 (0)