Skip to content

Commit 7b79c13

Browse files
updated openapi-generator for Dotnet to 7.12.0 (#474)
Co-authored-by: Juan Treminio <juantreminio@dropbox.com>
1 parent 549ec77 commit 7b79c13

49 files changed

Lines changed: 2133 additions & 193 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sdks/dotnet/.github/workflows/github-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Setup .NET
4141
uses: actions/setup-dotnet@v3
4242
with:
43-
dotnet-version: 6.0.x
43+
dotnet-version: 8.0.x
4444

4545
- name: Restore dependencies
4646
run: dotnet restore ${SOLUTION}.sln

sdks/dotnet/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ MigrationBackup/
361361
# Fody - auto-generated XML schema
362362
FodyWeavers.xsd
363363

364+
git_push.sh
365+
global.json
364366
vendor
365367
/api
366368
.openapi-generator

sdks/dotnet/.openapi-generator-ignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24-
25-
git_push.sh
26-
**/Model/*AllOf*
27-
docs/*AllOf*

sdks/dotnet/Dropbox.Sign.sln

100755100644
File mode changed.

sdks/dotnet/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ directory that corresponds to the file you want updated.
2323
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
2424

2525
- API version: 3.0.0
26-
- SDK version: 1.8-dev
27-
- Generator version: 7.8.0
26+
- SDK version: 2.0-dev
27+
- Generator version: 7.12.0
2828
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
2929

3030
### Building
@@ -49,7 +49,7 @@ this command.
4949
<a id="dependencies"></a>
5050
## Dependencies
5151

52-
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.13.0 or later
52+
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later
5353
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
5454
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
5555
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later

sdks/dotnet/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8-dev
1+
2.0-dev

sdks/dotnet/bin/copy-constants.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
ini_set('display_errors', 1);
7+
ini_set('display_startup_errors', 1);
8+
error_reporting(E_ALL);
9+
10+
set_error_handler(function ($level, $msg) {
11+
echo "Error: {$msg}";
12+
exit(1);
13+
});
14+
15+
/**
16+
* Between openapi-generator v7.8.0 and v7.12.0 a change was made to the way
17+
* a few generators create constant names from values. The original way was
18+
* actually broken. For example "change-field-visibility" would generate a
19+
* constant name of "TYPE_FIELD_VISIBILITY", dropping the "change" part.
20+
*
21+
* The fix now generates the correct name, "TYPE_CHANGE_FIELD_VISIBILITY".
22+
* However, the fix also gets rid of the previous (incorrect) constant names,
23+
* making the fix a BC break.
24+
*
25+
* This simple script just adds the old constant names back, alongside the new
26+
* ones.
27+
*/
28+
class CopyConstants
29+
{
30+
public function run(): void
31+
{
32+
$file = __DIR__ . '/../src/Dropbox.Sign/Model/SubFormFieldRuleAction.cs';
33+
$contents = file_get_contents($file);
34+
35+
$constant_1 = " ChangeFieldVisibility = 1,";
36+
$replace_1 = implode("\n", [
37+
$constant_1,
38+
' FieldVisibility = ChangeFieldVisibility,',
39+
]);
40+
41+
$constant_2 = " ChangeGroupVisibility = 2";
42+
$replace_2 = implode(",\n", [
43+
$constant_2,
44+
' GroupVisibility = ChangeGroupVisibility',
45+
]);
46+
47+
$contents = str_replace(
48+
$constant_1,
49+
$replace_1,
50+
$contents,
51+
);
52+
53+
$contents = str_replace(
54+
$constant_2,
55+
$replace_2,
56+
$contents,
57+
);
58+
59+
file_put_contents($file, $contents);
60+
}
61+
}
62+
63+
$copier = new CopyConstants();
64+
$copier->run();

sdks/dotnet/bin/dotnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ docker run --rm \
1212
-v "${ROOT_DIR}:${WORKING_DIR}" \
1313
-w "${WORKING_DIR}" \
1414
-u root:root \
15-
mcr.microsoft.com/dotnet/sdk:6.0 "$@"
15+
mcr.microsoft.com/dotnet/sdk:8.0 "$@"

sdks/dotnet/openapi-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ additionalProperties:
66
packageCompany: Dropbox Sign API Team
77
packageCopyright: Dropbox 2024
88
packageDescription: Client library for using the Dropbox Sign API
9-
packageVersion: 1.8-dev
9+
packageVersion: 2.0-dev
1010
packageTitle: Dropbox Sign .Net SDK
1111
sortModelPropertiesByRequiredFlag: true
1212
optionalEmitDefaultValues: true
13-
targetFramework: net6.0
13+
targetFramework: net8.0
14+
library: restsharp
1415
packageGuid: "{F8C8232D-7020-4603-8E04-18D060AE530B}"
1516
legacyDiscriminatorBehavior: true
1617
useCustomTemplateCode: true

sdks/dotnet/run-build

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/csharp
3+
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.12.0/modules/openapi-generator/src/main/resources/csharp
44

55
set -e
66

@@ -18,7 +18,7 @@ rm -f "${DIR}/src/Dropbox.Sign/Model/"*.cs
1818

1919
docker run --rm \
2020
-v "${DIR}/:/local" \
21-
openapitools/openapi-generator-cli:v7.8.0 generate \
21+
openapitools/openapi-generator-cli:v7.12.0 generate \
2222
-i "/local/openapi-sdk.yaml" \
2323
-c "/local/openapi-config.yaml" \
2424
-t "/local/templates" \
@@ -46,6 +46,9 @@ docker run --rm \
4646
-w "${WORKING_DIR}" \
4747
perl bash ./bin/scan_for
4848

49+
printf "Adding old-style constant names ...\n"
50+
bash "${DIR}/bin/php" ./bin/copy-constants.php
51+
4952
# avoid docker messing with permissions
5053
if [[ -z "$GITHUB_ACTIONS" ]]; then
5154
chmod 644 "${DIR}/README.md"

0 commit comments

Comments
 (0)