Skip to content

Commit 707766e

Browse files
authored
chore: reduce generated code (#135)
* chore: reduce code that is generated by the generator * chore: update constants and contribution guide * chore: drop unused private fields * chore: fix retry test to allow for 100ms buffer
1 parent 52546d7 commit 707766e

File tree

163 files changed

+630
-1514
lines changed

Some content is hidden

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

163 files changed

+630
-1514
lines changed

.openapi-generator-ignore

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
appveyor.yml
22
git_push.sh
33
api/openapi.yaml
4+
src/OpenFga.Sdk.Test/Api/*
5+
src/OpenFga.Sdk.Test/Client/*
46
src/OpenFga.Sdk.Test/Model/*
57
src/OpenFga.Sdk/ApiClient.cs
6-
src/OpenFga.Sdk/Client/ApiException.cs
7-
src/OpenFga.Sdk/Client/ApiResponse.cs
8-
src/OpenFga.Sdk/Client/ClientUtils.cs
9-
src/OpenFga.Sdk/Client/Configuration.cs
10-
src/OpenFga.Sdk/Client/ExceptionFactory.cs
11-
src/OpenFga.Sdk/Client/FileParameter.cs
12-
src/OpenFga.Sdk/Client/GlobalConfiguration.cs
13-
src/OpenFga.Sdk/Client/IApiAccessor.cs
14-
src/OpenFga.Sdk/Client/IAsynchronousClient.cs
15-
src/OpenFga.Sdk/Client/IReadableConfiguration.cs
16-
src/OpenFga.Sdk/Client/ISynchronousClient.cs
17-
src/OpenFga.Sdk/Client/Multimap.cs
18-
src/OpenFga.Sdk/Client/OpenAPIDateConverter.cs
19-
src/OpenFga.Sdk/Client/RequestOptions.cs
20-
src/OpenFga.Sdk/Client/RetryConfiguration.cs
21-
src/OpenFga.Sdk/Client/WebRequestPathBuilder.cs
8+
src/OpenFga.Sdk/Client/*

.openapi-generator/FILES

Lines changed: 2 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
.codecov.yml
2-
.editorconfig
3-
.fossa.yml
42
.github/CODEOWNERS
53
.github/ISSUE_TEMPLATE/bug_report.yaml
64
.github/ISSUE_TEMPLATE/config.yaml
75
.github/ISSUE_TEMPLATE/feature_request.yaml
86
.gitignore
9-
CHANGELOG.md
107
CONTRIBUTING.md
118
LICENSE
129
OpenFga.Sdk.sln
13-
OpenTelemetry.md
1410
README.md
15-
SUPPORTED_FRAMEWORKS.md
1611
VERSION.txt
17-
assets/FGAIcon.png
1812
docs/AbortedMessageResponse.md
1913
docs/Any.md
2014
docs/Assertion.md
@@ -102,87 +96,9 @@ docs/WriteAuthorizationModelResponse.md
10296
docs/WriteRequest.md
10397
docs/WriteRequestDeletes.md
10498
docs/WriteRequestWrites.md
105-
example/Example1/Example1.cs
106-
example/Example1/Example1.csproj
107-
example/Makefile
108-
example/OpenTelemetryExample/.env.example
109-
example/OpenTelemetryExample/OpenTelemetryExample.cs
110-
example/OpenTelemetryExample/OpenTelemetryExample.csproj
111-
example/README.md
112-
src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs
113-
src/OpenFga.Sdk.Test/ApiClient/OAuth2ClientTests.cs
114-
src/OpenFga.Sdk.Test/ApiClient/RetryHandlerTests.cs
115-
src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs
116-
src/OpenFga.Sdk.Test/Models/Client/ClientBatchCheckResponseTest.cs
117-
src/OpenFga.Sdk.Test/Models/ModelTests.cs
11899
src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj
119100
src/OpenFga.Sdk/Api/OpenFgaApi.cs
120-
src/OpenFga.Sdk/ApiClient/ApiClient.cs
121-
src/OpenFga.Sdk/ApiClient/BaseClient.cs
122-
src/OpenFga.Sdk/ApiClient/OAuth2Client.cs
123-
src/OpenFga.Sdk/ApiClient/RequestBuilder.cs
124-
src/OpenFga.Sdk/ApiClient/RetryHandler.cs
125-
src/OpenFga.Sdk/ApiClient/Utils.cs
126-
src/OpenFga.Sdk/Client/ApiClient.cs
127-
src/OpenFga.Sdk/Client/Client.cs
128-
src/OpenFga.Sdk/Client/ClientConfiguration.cs
129-
src/OpenFga.Sdk/Client/Extensions/LinqExtensions.cs
130-
src/OpenFga.Sdk/Client/Model/AuthorizationModelIdOptions.cs
131-
src/OpenFga.Sdk/Client/Model/ClientBatchCheckOptions.cs
132-
src/OpenFga.Sdk/Client/Model/ClientBatchCheckResponse.cs
133-
src/OpenFga.Sdk/Client/Model/ClientCheckOptions.cs
134-
src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs
135-
src/OpenFga.Sdk/Client/Model/ClientConsistencyOptions.cs
136-
src/OpenFga.Sdk/Client/Model/ClientCreateStoreOptions.cs
137-
src/OpenFga.Sdk/Client/Model/ClientCreateStoreRequest.cs
138-
src/OpenFga.Sdk/Client/Model/ClientExpandOptions.cs
139-
src/OpenFga.Sdk/Client/Model/ClientExpandRequest.cs
140-
src/OpenFga.Sdk/Client/Model/ClientListObjectsOptions.cs
141-
src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs
142-
src/OpenFga.Sdk/Client/Model/ClientListRelationsOptions.cs
143-
src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs
144-
src/OpenFga.Sdk/Client/Model/ClientListRelationsResponse.cs
145-
src/OpenFga.Sdk/Client/Model/ClientListStoresOptions.cs
146-
src/OpenFga.Sdk/Client/Model/ClientListStoresRequest.cs
147-
src/OpenFga.Sdk/Client/Model/ClientListUsersOptions.cs
148-
src/OpenFga.Sdk/Client/Model/ClientListUsersRequest.cs
149-
src/OpenFga.Sdk/Client/Model/ClientPaginationOptions.cs
150-
src/OpenFga.Sdk/Client/Model/ClientReadAssertionsOptions.cs
151-
src/OpenFga.Sdk/Client/Model/ClientReadAuthorizaionModelOptions.cs
152-
src/OpenFga.Sdk/Client/Model/ClientReadAuthorizaionModelsOptions.cs
153-
src/OpenFga.Sdk/Client/Model/ClientReadChangesOptions.cs
154-
src/OpenFga.Sdk/Client/Model/ClientReadChangesRequest.cs
155-
src/OpenFga.Sdk/Client/Model/ClientReadOptions.cs
156-
src/OpenFga.Sdk/Client/Model/ClientReadRequest.cs
157-
src/OpenFga.Sdk/Client/Model/ClientRequestOptions.cs
158-
src/OpenFga.Sdk/Client/Model/ClientRequestOptsWithAuthZModelId.cs
159-
src/OpenFga.Sdk/Client/Model/ClientRequestOptsWithStoreId.cs
160-
src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs
161-
src/OpenFga.Sdk/Client/Model/ClientTupleKeyWithoutCondition.cs
162-
src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsOptions.cs
163-
src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs
164-
src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs
165-
src/OpenFga.Sdk/Client/Model/ClientWriteOptions.cs
166-
src/OpenFga.Sdk/Client/Model/ClientWriteRequest.cs
167-
src/OpenFga.Sdk/Client/Model/ClientWriteResponse.cs
168-
src/OpenFga.Sdk/Client/Model/ClientWriteStatus.cs
169-
src/OpenFga.Sdk/Client/Model/RetryParams.cs
170-
src/OpenFga.Sdk/Client/Model/StoreIdOptions.cs
171-
src/OpenFga.Sdk/Configuration/Configuration.cs
172-
src/OpenFga.Sdk/Configuration/Credentials.cs
173-
src/OpenFga.Sdk/Configuration/TelemetryConfig.cs
174-
src/OpenFga.Sdk/Exceptions/ApiAuthenticationError.cs
175-
src/OpenFga.Sdk/Exceptions/ApiError.cs
176-
src/OpenFga.Sdk/Exceptions/ApiException.cs
177-
src/OpenFga.Sdk/Exceptions/ApiInternalError.cs
178-
src/OpenFga.Sdk/Exceptions/ApiNotFoundError.cs
179-
src/OpenFga.Sdk/Exceptions/ApiValidationError.cs
180-
src/OpenFga.Sdk/Exceptions/GenericError.cs
181-
src/OpenFga.Sdk/Exceptions/Parsers/ApiErrorParser.cs
182-
src/OpenFga.Sdk/Exceptions/Parsers/RateLimitParser.cs
183-
src/OpenFga.Sdk/Exceptions/RateLimitExceededError.cs
184-
src/OpenFga.Sdk/Exceptions/RequiredParamError.cs
185-
src/OpenFga.Sdk/Exceptions/ValidationError.cs
101+
src/OpenFga.Sdk/Constants/FgaConstants.cs
186102
src/OpenFga.Sdk/Model/AbortedMessageResponse.cs
187103
src/OpenFga.Sdk/Model/AbstractOpenAPISchema.cs
188104
src/OpenFga.Sdk/Model/Any.cs
@@ -216,7 +132,6 @@ src/OpenFga.Sdk/Model/ForbiddenResponse.cs
216132
src/OpenFga.Sdk/Model/GetStoreResponse.cs
217133
src/OpenFga.Sdk/Model/InternalErrorCode.cs
218134
src/OpenFga.Sdk/Model/InternalErrorMessageResponse.cs
219-
src/OpenFga.Sdk/Model/JsonStringEnumMemberConverter.cs
220135
src/OpenFga.Sdk/Model/Leaf.cs
221136
src/OpenFga.Sdk/Model/ListObjectsRequest.cs
222137
src/OpenFga.Sdk/Model/ListObjectsResponse.cs
@@ -272,10 +187,4 @@ src/OpenFga.Sdk/Model/WriteAuthorizationModelResponse.cs
272187
src/OpenFga.Sdk/Model/WriteRequest.cs
273188
src/OpenFga.Sdk/Model/WriteRequestDeletes.cs
274189
src/OpenFga.Sdk/Model/WriteRequestWrites.cs
275-
src/OpenFga.Sdk/OpenFga.Sdk.csproj
276-
src/OpenFga.Sdk/Properties/AssemblyInfo.cs
277-
src/OpenFga.Sdk/Telemetry/Attributes.cs
278-
src/OpenFga.Sdk/Telemetry/Counters.cs
279-
src/OpenFga.Sdk/Telemetry/Histograms.cs
280-
src/OpenFga.Sdk/Telemetry/Meters.cs
281-
src/OpenFga.Sdk/Telemetry/Metrics.cs
190+
src/OpenFga.Sdk/OpenFga.Sdk.csproj

CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,23 @@ By participating and contributing to this project, you are expected to uphold ou
2323

2424
### Making Changes
2525

26-
When contributing to a repository, the first step is to open an issue on [sdk-generator](https://github.com/openfga/sdk-generator) to discuss the change you wish to make before making them.
26+
When contributing to a repository, the first step is to open [an issue](https://github.com/openfga/dotnet-sdk/issues) to discuss the change you wish to make before making them.
2727

2828
### Opening Issues
2929

3030
Before you submit a new issue please make sure to search all open and closed issues. It is possible your feature request/issue has already been answered. Make sure to also check the [OpenFGA discussions](https://github.com/orgs/openfga/discussions).
3131

32-
That repo includes an issue template that will walk through all the places to check before submitting your issue here. Please follow the instructions there to make sure this is not a duplicate issue and that we have everything we need to research and reproduce this problem.
32+
The repo includes an issue template that will walk through all the places to check before submitting your issue here. Please follow the instructions there to make sure this is not a duplicate issue and that we have everything we need to research and reproduce this problem.
33+
34+
If you have found a bug or if you have a feature request, please report them in the [repo issues](https://github.com/openfga/dotnet-sdk/issues). Cross-SDK bugs and feature requests can be additionally reported in the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section, where the individual SDK issue is then linked.
35+
36+
**Please do not report security vulnerabilities on the public GitHub issue tracker.**
3337

3438
### Submitting Pull Requests
3539

36-
While we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well.
40+
Feel free to submit a Pull Request against this repository. Please make sure to follow the existing code style and include tests where applicable.
41+
42+
Some files in this repository are autogenerated. These files have a comment at the top indicating that they are autogenerated and should not be modified directly - the files are usually identified by a header marking them as such, or by their inclusion in [`.openapi-generator/FILES`](./.openapi-generator/FILES). Changes to these files should be made in the [sdk-generator](https://github.com/openfga/sdk-generator) repository in tandem, so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well.
3743

3844
## Getting in touch
3945

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This is an autogenerated SDK for OpenFGA. It provides a wrapper around the [Open
1818
- [Installation](#installation)
1919
- [Getting Started](#getting-started)
2020
- [Initializing the API Client](#initializing-the-api-client)
21+
- [Custom Headers](#custom-headers)
2122
- [Get your Store ID](#get-your-store-id)
2223
- [Calling the API](#calling-the-api)
2324
- [Stores](#stores)
@@ -1041,13 +1042,7 @@ This SDK supports producing metrics that can be consumed as part of an [OpenTele
10411042

10421043
## Contributing
10431044

1044-
### Issues
1045-
1046-
If you have found a bug or if you have a feature request, please report them on the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section. Please do not report security vulnerabilities on the public GitHub issue tracker.
1047-
1048-
### Pull Requests
1049-
1050-
All changes made to this repo will be overwritten on the next generation, so we kindly ask that you send all pull requests related to the SDKs to the [sdk-generator repo](https://github.com/openfga/sdk-generator) instead.
1045+
See [CONTRIBUTING](./CONTRIBUTING.md) for details.
10511046

10521047
## Author
10531048

src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
131
using Moq;
142
using Moq.Protected;
153
using OpenFga.Sdk.Api;
@@ -2845,10 +2833,8 @@ public async Task RetryMultipleRetriesWithDifferentDelaysTimingVerification() {
28452833
var delay1 = attemptTimes[1] - attemptTimes[0];
28462834
var delay2 = attemptTimes[2] - attemptTimes[1];
28472835

2848-
Assert.True(delay1 >= 1000, $"First retry delay should be ~1000ms, got {delay1}ms");
2849-
Assert.True(delay1 < 1300, $"First retry delay should be ~1000ms, got {delay1}ms");
2850-
Assert.True(delay2 >= 2000, $"Second retry delay should be ~2000ms, got {delay2}ms");
2851-
Assert.True(delay2 < 2300, $"Second retry delay should be ~2000ms, got {delay2}ms");
2836+
Assert.InRange(delay1, 900, 1100);
2837+
Assert.InRange(delay2, 1900, 2100);
28522838
}
28532839

28542840
[Fact]

src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
13-
141
using Moq;
152
using Moq.Protected;
163
using OpenFga.Sdk.ApiClient;

src/OpenFga.Sdk.Test/Models/Client/ClientBatchCheckResponseTest.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
13-
141
using OpenFga.Sdk.Client.Model;
152
using System.Collections.Generic;
163
using Xunit;

src/OpenFga.Sdk.Test/Models/ModelTests.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
13-
141
using OpenFga.Sdk.Model;
152
using System;
163
using System.Collections.Generic;

src/OpenFga.Sdk/ApiClient/ApiClient.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
13-
141
using OpenFga.Sdk.Client;
152
using OpenFga.Sdk.Client.Model;
163
using OpenFga.Sdk.Configuration;

src/OpenFga.Sdk/ApiClient/BaseClient.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//
2-
// OpenFGA/.NET SDK for OpenFGA
3-
//
4-
// API version: 1.x
5-
// Website: https://openfga.dev
6-
// Documentation: https://openfga.dev/docs
7-
// Support: https://openfga.dev/community
8-
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
9-
//
10-
// NOTE: This file was auto generated. DO NOT EDIT.
11-
//
12-
13-
141
using OpenFga.Sdk.Exceptions;
152
using System;
163
using System.Collections.Generic;

0 commit comments

Comments
 (0)