From cc66df80014dae888c6627749911beb473e904d1 Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Fri, 1 Dec 2023 07:04:42 -0500 Subject: [PATCH] chore: update documentation and ci --- .github/ISSUE_TEMPLATE/bug_report.md | 64 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 30 +++++++++ .github/workflows/main.yaml | 5 +- .github/workflows/semgrep.yaml | 4 +- .openapi-generator/FILES | 4 +- README.md | 18 +++--- docs/ListStoresResponse.md | 2 +- docs/OpenFgaApi.md | 14 ++-- docs/ReadAuthorizationModelsResponse.md | 2 +- docs/ReadChangesResponse.md | 2 +- docs/ReadResponse.md | 2 +- src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj | 6 +- src/OpenFga.Sdk/Api/OpenFgaApi.cs | 8 +-- .../Configuration/Configuration.cs | 5 +- src/OpenFga.Sdk/Model/Any.cs | 1 + src/OpenFga.Sdk/Model/Assertion.cs | 2 + src/OpenFga.Sdk/Model/AuthorizationModel.cs | 3 + src/OpenFga.Sdk/Model/CheckRequest.cs | 4 ++ src/OpenFga.Sdk/Model/CheckResponse.cs | 2 + src/OpenFga.Sdk/Model/Computed.cs | 1 + src/OpenFga.Sdk/Model/ContextualTupleKeys.cs | 1 + src/OpenFga.Sdk/Model/CreateStoreRequest.cs | 1 + src/OpenFga.Sdk/Model/CreateStoreResponse.cs | 4 ++ src/OpenFga.Sdk/Model/Difference.cs | 2 + src/OpenFga.Sdk/Model/ExpandRequest.cs | 2 + src/OpenFga.Sdk/Model/ExpandResponse.cs | 1 + src/OpenFga.Sdk/Model/GetStoreResponse.cs | 4 ++ .../Model/InternalErrorMessageResponse.cs | 1 + src/OpenFga.Sdk/Model/Leaf.cs | 3 + src/OpenFga.Sdk/Model/ListObjectsRequest.cs | 5 ++ src/OpenFga.Sdk/Model/ListObjectsResponse.cs | 1 + src/OpenFga.Sdk/Model/ListStoresResponse.cs | 7 +- src/OpenFga.Sdk/Model/Metadata.cs | 1 + src/OpenFga.Sdk/Model/Node.cs | 5 ++ src/OpenFga.Sdk/Model/Nodes.cs | 1 + src/OpenFga.Sdk/Model/ObjectRelation.cs | 2 + .../Model/PathUnknownErrorMessageResponse.cs | 1 + .../Model/ReadAssertionsResponse.cs | 2 + .../Model/ReadAuthorizationModelResponse.cs | 1 + .../Model/ReadAuthorizationModelsResponse.cs | 7 +- src/OpenFga.Sdk/Model/ReadChangesResponse.cs | 7 +- src/OpenFga.Sdk/Model/ReadRequest.cs | 3 + src/OpenFga.Sdk/Model/ReadResponse.cs | 7 +- src/OpenFga.Sdk/Model/RelationMetadata.cs | 1 + src/OpenFga.Sdk/Model/RelationReference.cs | 3 + src/OpenFga.Sdk/Model/Status.cs | 3 + src/OpenFga.Sdk/Model/Store.cs | 5 ++ src/OpenFga.Sdk/Model/Tuple.cs | 2 + src/OpenFga.Sdk/Model/TupleChange.cs | 2 + src/OpenFga.Sdk/Model/TupleKey.cs | 3 + src/OpenFga.Sdk/Model/TupleKeys.cs | 1 + src/OpenFga.Sdk/Model/TupleToUserset.cs | 2 + src/OpenFga.Sdk/Model/TypeDefinition.cs | 3 + src/OpenFga.Sdk/Model/Users.cs | 1 + src/OpenFga.Sdk/Model/Userset.cs | 6 ++ src/OpenFga.Sdk/Model/UsersetTree.cs | 1 + .../Model/UsersetTreeDifference.cs | 2 + .../Model/UsersetTreeTupleToUserset.cs | 2 + src/OpenFga.Sdk/Model/Usersets.cs | 1 + .../Model/ValidationErrorMessageResponse.cs | 1 + .../Model/WriteAssertionsRequest.cs | 1 + .../Model/WriteAuthorizationModelRequest.cs | 2 + .../Model/WriteAuthorizationModelResponse.cs | 1 + src/OpenFga.Sdk/Model/WriteRequest.cs | 3 + 64 files changed, 252 insertions(+), 42 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b929a17 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,64 @@ +--- +name: Report an issue +about: Create a bug report about an existing issue. +title: '' +labels: 'bug' +assignees: '' + +--- + +**Please do not report security vulnerabilities here**. See the [Responsible Disclosure Program](https://github.com/openfga/dotnet-sdk/blob/main/.github/SECURITY.md). + +**Thank you in advance for helping us to improve this library!** Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. + +By submitting an issue to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/rfcs/blob/main/CODE-OF-CONDUCT.md). + +### Description + +> Provide a clear and concise description of the issue, including what you expected to happen. + +### Version of SDK + +> v0.2.0 + +### Version of OpenFGA (if known) + +> v1.1.0 + +### OpenFGA Flags/Custom Configuration Applicable + +> environment: +> - OPENFGA_DATASTORE_ENGINE=postgres +> - OPENFGA_DATASTORE_URI=postgres://postgres:password@postgres:5432/postgres?sslmode=disable +> - OPENFGA_TRACE_ENABLED=true +> - OPENFGA_TRACE_SAMPLE_RATIO=1 +> - OPENFGA_TRACE_OTLP_ENDPOINT=otel-collector:4317 +> - OPENFGA_METRICS_ENABLE_RPC_HISTOGRAMS=true + +### Reproduction + +> Detail the steps taken to reproduce this error, what was expected, and whether this issue can be reproduced consistently or if it is intermittent. +> +> 1. Initialize OpenFgaClient with openfga_sdk.ClientConfiguration parameter api_host=127.0.0.1, credentials method client_credentials +> 2. Invoke method read_authorization_models +> 3. See exception thrown + +### Sample Code the Produces Issues + +> +> ``` +> +> ``` + +### Backtrace (if applicable) + +> ``` +> +> ``` + + +### Expected behavior +> A clear and concise description of what you expected to happen. + +### Additional context +> Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..295885f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,30 @@ +--- +name: Feature request +about: Suggest new functionality for this project. +title: '' +labels: 'feature' +assignees: '' + +--- + +**Please do not report security vulnerabilities here**. See the [Responsible Disclosure Program](https://github.com/openfga/dotnet-sdk/blob/main/.github/SECURITY.md). + +**Thank you in advance for helping us to improve this library!** Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. + +By submitting an issue to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/rfcs/blob/main/CODE-OF-CONDUCT.md). + +### Describe the problem you'd like to have solved + +> A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +### Describe the ideal solution + +> A clear and concise description of what you want to happen. + +## Alternatives and current workarounds + +> A clear and concise description of any alternatives you've considered or any workarounds that are currently in place. + +### Additional context + +> Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index be16825..08d8b3b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,6 +1,7 @@ name: Build, Test and Release on: + merge_group: push: pull_request: workflow_dispatch: @@ -13,7 +14,7 @@ jobs: - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v2 with: dotnet-version: 6.0.x @@ -40,7 +41,7 @@ jobs: - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v2 with: dotnet-version: 6.0.x source-url: https://api.nuget.org/v3/index.json diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 66e24d3..92f9ad6 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -11,7 +11,9 @@ jobs: image: returntocorp/semgrep if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 - run: semgrep ci env: SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 390346f..c3f6e41 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,8 +1,8 @@ .editorconfig .fossa.yml .github/CODEOWNERS -.github/ISSUE_TEMPLATES/bug_report.md -.github/ISSUE_TEMPLATES/feature_request.md +.github/ISSUE_TEMPLATE/bug_report.md +.github/ISSUE_TEMPLATE/feature_request.md .github/workflows/main.yaml .github/workflows/semgrep.yaml .gitignore diff --git a/README.md b/README.md index db36f51..5a174e5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Release](https://img.shields.io/github/v/release/openfga/dotnet-sdk?sort=semver&color=green)](https://github.com/openfga/dotnet-sdk/releases) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fdotnet-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fdotnet-sdk?ref=badge_shield) -[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.com/channels/759188666072825867/930524706854031421) +[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.gg/8naAwJfWN6) [![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga) This is an autogenerated SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api). @@ -534,9 +534,9 @@ var options = new ClientCheckOptions { AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1", }; var body = new ClientCheckRequest { - Object = "document:roadmap", + User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation = "writer", - User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b" + Object = "document:roadmap" }; var response = await fgaClient.Check(body, options); // response.Allowed = true @@ -656,7 +656,7 @@ var response = await fgaClient.Expand(body, options); // response.Tree.Root = {"name":"document:roadmap#viewer","leaf":{"users":{"users":["user:81684243-9356-4421-8fbf-a4f8d36aa31b","user:f52a4f7a-054d-47ff-bb6e-3ac81269988f"]}}} ``` -#### List Objects +##### List Objects List the objects of a particular type a user has access to. @@ -684,7 +684,7 @@ var response = await fgaClient.ListObjects(body, options); // response.Objects = ["document:roadmap"] ``` -#### List Relations +##### List Relations List the relations a user has on an object. @@ -707,9 +707,9 @@ var response = await fgaClient.ListRelations(body); // response.Relations = ["can_view", "can_edit"] ``` -### Assertions +#### Assertions -#### Read Assertions +##### Read Assertions Read assertions for a particular authorization model. @@ -723,7 +723,7 @@ var options = new ClientReadAssertionsOptions { var response = await fgaClient.ReadAssertions(options); ``` -#### Write Assertions +##### Write Assertions Update the assertions for a particular authorization model. @@ -753,7 +753,7 @@ await fgaClient.WriteAssertions(body, options); | [**DeleteStore**](docs/OpenFgaApi.md#deletestore) | **DELETE** /stores/{store_id} | Delete a store | | [**Expand**](docs/OpenFgaApi.md#expand) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship | | [**GetStore**](docs/OpenFgaApi.md#getstore) | **GET** /stores/{store_id} | Get a store | -| [**ListObjects**](docs/OpenFgaApi.md#listobjects) | **POST** /stores/{store_id}/list-objects | Get all objects of the given type that the user has a relation with | +| [**ListObjects**](docs/OpenFgaApi.md#listobjects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with | | [**ListStores**](docs/OpenFgaApi.md#liststores) | **GET** /stores | List all stores | | [**Read**](docs/OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules | | [**ReadAssertions**](docs/OpenFgaApi.md#readassertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID | diff --git a/docs/ListStoresResponse.md b/docs/ListStoresResponse.md index 4909db1..590bcd4 100644 --- a/docs/ListStoresResponse.md +++ b/docs/ListStoresResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Stores** | [**List<Store>**](Store.md) | | [optional] -**ContinuationToken** | **string** | | [optional] +**ContinuationToken** | **string** | The continuation token will be empty if there are no more stores. | [optional] [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OpenFgaApi.md b/docs/OpenFgaApi.md index 1f4c91c..ff35b80 100644 --- a/docs/OpenFgaApi.md +++ b/docs/OpenFgaApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description [**DeleteStore**](OpenFgaApi.md#deletestore) | **DELETE** /stores/{store_id} | Delete a store [**Expand**](OpenFgaApi.md#expand) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship [**GetStore**](OpenFgaApi.md#getstore) | **GET** /stores/{store_id} | Get a store -[**ListObjects**](OpenFgaApi.md#listobjects) | **POST** /stores/{store_id}/list-objects | Get all objects of the given type that the user has a relation with +[**ListObjects**](OpenFgaApi.md#listobjects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with [**ListStores**](OpenFgaApi.md#liststores) | **GET** /stores | List all stores [**Read**](OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules [**ReadAssertions**](OpenFgaApi.md#readassertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID @@ -403,9 +403,9 @@ Name | Type | Description | Notes # **ListObjects** > ListObjectsResponse ListObjects (ListObjectsRequest body) -Get all objects of the given type that the user has a relation with +List all objects of the given type that the user has a relation with -The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is, it will be used to decide the underlying implementation used. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `:` (e.g. \"document:roadmap\"). Note: If you have `and` or `but not` in your model while using ListObjects, checkout the [caveats](https://openfga.dev/docs/interacting/relationship-queries#caveats-and-when-not-to-use-it-3). +The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `:` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. The objects given will not be sorted, and therefore two identical calls can give a given different set of objects. ### Example ```csharp @@ -434,7 +434,7 @@ namespace Example try { - // Get all objects of the given type that the user has a relation with + // List all objects of the given type that the user has a relation with ListObjectsResponse response = await openFgaApi.ListObjects(body); Debug.WriteLine(response); } @@ -482,7 +482,7 @@ Name | Type | Description | Notes List all stores -Returns a paginated list of OpenFGA stores. +Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. ### Example ```csharp @@ -559,7 +559,7 @@ Name | Type | Description | Notes Get tuples from the store that matches a query, without following userset rewrite rules -The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. tuple_key is optional. If tuple_key is not specified, it will return all tuples in the store.2. `tuple_key.object` is mandatory if tuple_key is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the document type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and an optional continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. ### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that the API will not return writers such as `user:anne` even when all writers are readers. This is because only direct relationship are returned for the READ API. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). +The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query. ### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). ### Example ```csharp @@ -790,7 +790,7 @@ Name | Type | Description | Notes Return all the authorization models for a particular store -The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ] } ``` If there are more authorization models available, the response will contain an extra field `continuation_token`: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` +The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` ### Example ```csharp diff --git a/docs/ReadAuthorizationModelsResponse.md b/docs/ReadAuthorizationModelsResponse.md index 29ccbf0..eb1e014 100644 --- a/docs/ReadAuthorizationModelsResponse.md +++ b/docs/ReadAuthorizationModelsResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AuthorizationModels** | [**List<AuthorizationModel>**](AuthorizationModel.md) | | [optional] -**ContinuationToken** | **string** | | [optional] +**ContinuationToken** | **string** | The continuation token will be empty if there are no more models. | [optional] [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ReadChangesResponse.md b/docs/ReadChangesResponse.md index 9faf824..3c054ab 100644 --- a/docs/ReadChangesResponse.md +++ b/docs/ReadChangesResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Changes** | [**List<TupleChange>**](TupleChange.md) | | [optional] -**ContinuationToken** | **string** | | [optional] +**ContinuationToken** | **string** | The continuation token will be identical if there are no new changes. | [optional] [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ReadResponse.md b/docs/ReadResponse.md index 0f40497..e0e8eab 100644 --- a/docs/ReadResponse.md +++ b/docs/ReadResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Tuples** | [**List<Tuple>**](Tuple.md) | | [optional] -**ContinuationToken** | **string** | | [optional] +**ContinuationToken** | **string** | The continuation token will be empty if there are no more tuples. | [optional] [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) diff --git a/src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj b/src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj index 250fbeb..9b3c9a7 100644 --- a/src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj +++ b/src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj @@ -9,9 +9,9 @@ - all - all - all + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/OpenFga.Sdk/Api/OpenFgaApi.cs b/src/OpenFga.Sdk/Api/OpenFgaApi.cs index 3f7d25b..bbdb8e1 100644 --- a/src/OpenFga.Sdk/Api/OpenFgaApi.cs +++ b/src/OpenFga.Sdk/Api/OpenFgaApi.cs @@ -184,7 +184,7 @@ public async Task GetStore(CancellationToken cancellationToken } /// - /// Get all objects of the given type that the user has a relation with The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is, it will be used to decide the underlying implementation used. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). Note: If you have `and` or `but not` in your model while using ListObjects, checkout the [caveats](https://openfga.dev/docs/interacting/relationship-queries#caveats-and-when-not-to-use-it-3). + /// List all objects of the given type that the user has a relation with The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. The objects given will not be sorted, and therefore two identical calls can give a given different set of objects. /// /// Thrown when fails to make API call /// @@ -214,7 +214,7 @@ public async Task ListObjects(ListObjectsRequest body, Canc } /// - /// List all stores Returns a paginated list of OpenFGA stores. + /// List all stores Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. /// /// Thrown when fails to make API call /// (optional) @@ -245,7 +245,7 @@ public async Task ListObjects(ListObjectsRequest body, Canc } /// - /// Get tuples from the store that matches a query, without following userset rewrite rules The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. tuple_key is optional. If tuple_key is not specified, it will return all tuples in the store.2. `tuple_key.object` is mandatory if tuple_key is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the document type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and an optional continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. ### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that the API will not return writers such as `user:anne` even when all writers are readers. This is because only direct relationship are returned for the READ API. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). + /// Get tuples from the store that matches a query, without following userset rewrite rules The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query. ### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). /// /// Thrown when fails to make API call /// @@ -339,7 +339,7 @@ public async Task ReadAuthorizationModel(string } /// - /// Return all the authorization models for a particular store The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ] } ``` If there are more authorization models available, the response will contain an extra field `continuation_token`: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` + /// Return all the authorization models for a particular store The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` /// /// Thrown when fails to make API call /// (optional) diff --git a/src/OpenFga.Sdk/Configuration/Configuration.cs b/src/OpenFga.Sdk/Configuration/Configuration.cs index 48ad3b0..a8acf36 100644 --- a/src/OpenFga.Sdk/Configuration/Configuration.cs +++ b/src/OpenFga.Sdk/Configuration/Configuration.cs @@ -62,6 +62,8 @@ public void IsValid() { /// Version of the package. public const string Version = "0.2.4"; + private const string DefaultUserAgent = "openfga-sdk dotnet/0.2.4"; + #endregion Constants #region Constructors @@ -79,11 +81,10 @@ public Configuration(string storeId) : this() { /// /// public Configuration() { - UserAgent = "openfga-sdk {sdkId}/{packageVersion}".Replace("{sdkId}", "dotnet").Replace("{packageVersion}", Version); DefaultHeaders ??= new Dictionary(); if (!DefaultHeaders.ContainsKey("User-Agent")) { - DefaultHeaders.Add("User-Agent", UserAgent); + DefaultHeaders.Add("User-Agent", DefaultUserAgent); } } diff --git a/src/OpenFga.Sdk/Model/Any.cs b/src/OpenFga.Sdk/Model/Any.cs index 019c4a0..fd6c0d3 100644 --- a/src/OpenFga.Sdk/Model/Any.cs +++ b/src/OpenFga.Sdk/Model/Any.cs @@ -41,6 +41,7 @@ public Any() { } /// [DataMember(Name = "@type", EmitDefaultValue = false)] [JsonPropertyName("@type")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Type { get; set; } diff --git a/src/OpenFga.Sdk/Model/Assertion.cs b/src/OpenFga.Sdk/Model/Assertion.cs index 54f1f51..7eeb084 100644 --- a/src/OpenFga.Sdk/Model/Assertion.cs +++ b/src/OpenFga.Sdk/Model/Assertion.cs @@ -50,6 +50,7 @@ public Assertion() { /// [DataMember(Name = "tuple_key", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("tuple_key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey TupleKey { get; set; } /// @@ -57,6 +58,7 @@ public Assertion() { /// [DataMember(Name = "expectation", IsRequired = true, EmitDefaultValue = true)] [JsonPropertyName("expectation")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public bool Expectation { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/AuthorizationModel.cs b/src/OpenFga.Sdk/Model/AuthorizationModel.cs index ee12db6..f22d7b6 100644 --- a/src/OpenFga.Sdk/Model/AuthorizationModel.cs +++ b/src/OpenFga.Sdk/Model/AuthorizationModel.cs @@ -52,6 +52,7 @@ public AuthorizationModel() { /// [DataMember(Name = "id", EmitDefaultValue = false)] [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Id { get; set; } /// @@ -59,6 +60,7 @@ public AuthorizationModel() { /// [DataMember(Name = "schema_version", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("schema_version")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string SchemaVersion { get; set; } /// @@ -66,6 +68,7 @@ public AuthorizationModel() { /// [DataMember(Name = "type_definitions", EmitDefaultValue = false)] [JsonPropertyName("type_definitions")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? TypeDefinitions { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/CheckRequest.cs b/src/OpenFga.Sdk/Model/CheckRequest.cs index be52318..3e8c526 100644 --- a/src/OpenFga.Sdk/Model/CheckRequest.cs +++ b/src/OpenFga.Sdk/Model/CheckRequest.cs @@ -52,6 +52,7 @@ public CheckRequest() { /// [DataMember(Name = "tuple_key", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("tuple_key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey TupleKey { get; set; } /// @@ -59,6 +60,7 @@ public CheckRequest() { /// [DataMember(Name = "contextual_tuples", EmitDefaultValue = false)] [JsonPropertyName("contextual_tuples")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ContextualTupleKeys? ContextualTuples { get; set; } /// @@ -66,6 +68,7 @@ public CheckRequest() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } /// @@ -74,6 +77,7 @@ public CheckRequest() { /// Defaults to false. Making it true has performance implications. [DataMember(Name = "trace", EmitDefaultValue = true)] [JsonPropertyName("trace")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public bool? Trace { get; private set; } /// diff --git a/src/OpenFga.Sdk/Model/CheckResponse.cs b/src/OpenFga.Sdk/Model/CheckResponse.cs index cd86532..e368fba 100644 --- a/src/OpenFga.Sdk/Model/CheckResponse.cs +++ b/src/OpenFga.Sdk/Model/CheckResponse.cs @@ -46,6 +46,7 @@ public CheckResponse() { /// [DataMember(Name = "allowed", EmitDefaultValue = true)] [JsonPropertyName("allowed")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public bool? Allowed { get; set; } /// @@ -54,6 +55,7 @@ public CheckResponse() { /// For internal use only. [DataMember(Name = "resolution", EmitDefaultValue = false)] [JsonPropertyName("resolution")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Resolution { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Computed.cs b/src/OpenFga.Sdk/Model/Computed.cs index 3fb9d07..b9da040 100644 --- a/src/OpenFga.Sdk/Model/Computed.cs +++ b/src/OpenFga.Sdk/Model/Computed.cs @@ -44,6 +44,7 @@ public Computed() { /// [DataMember(Name = "userset", EmitDefaultValue = false)] [JsonPropertyName("userset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Userset { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ContextualTupleKeys.cs b/src/OpenFga.Sdk/Model/ContextualTupleKeys.cs index cb10c69..76ef067 100644 --- a/src/OpenFga.Sdk/Model/ContextualTupleKeys.cs +++ b/src/OpenFga.Sdk/Model/ContextualTupleKeys.cs @@ -48,6 +48,7 @@ public ContextualTupleKeys() { /// [DataMember(Name = "tuple_keys", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("tuple_keys")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List TupleKeys { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/CreateStoreRequest.cs b/src/OpenFga.Sdk/Model/CreateStoreRequest.cs index e8bf476..f3c76b0 100644 --- a/src/OpenFga.Sdk/Model/CreateStoreRequest.cs +++ b/src/OpenFga.Sdk/Model/CreateStoreRequest.cs @@ -48,6 +48,7 @@ public CreateStoreRequest() { /// [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Name { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/CreateStoreResponse.cs b/src/OpenFga.Sdk/Model/CreateStoreResponse.cs index 720e50d..0aac8b2 100644 --- a/src/OpenFga.Sdk/Model/CreateStoreResponse.cs +++ b/src/OpenFga.Sdk/Model/CreateStoreResponse.cs @@ -50,6 +50,7 @@ public CreateStoreResponse() { /// [DataMember(Name = "id", EmitDefaultValue = false)] [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Id { get; set; } /// @@ -57,6 +58,7 @@ public CreateStoreResponse() { /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Name { get; set; } /// @@ -64,6 +66,7 @@ public CreateStoreResponse() { /// [DataMember(Name = "created_at", EmitDefaultValue = false)] [JsonPropertyName("created_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? CreatedAt { get; set; } /// @@ -71,6 +74,7 @@ public CreateStoreResponse() { /// [DataMember(Name = "updated_at", EmitDefaultValue = false)] [JsonPropertyName("updated_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? UpdatedAt { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Difference.cs b/src/OpenFga.Sdk/Model/Difference.cs index 7271216..69e4f21 100644 --- a/src/OpenFga.Sdk/Model/Difference.cs +++ b/src/OpenFga.Sdk/Model/Difference.cs @@ -54,6 +54,7 @@ public Difference() { /// [DataMember(Name = "base", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("base")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Userset Base { get; set; } /// @@ -61,6 +62,7 @@ public Difference() { /// [DataMember(Name = "subtract", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("subtract")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Userset Subtract { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ExpandRequest.cs b/src/OpenFga.Sdk/Model/ExpandRequest.cs index 6aef8ff..059ed1a 100644 --- a/src/OpenFga.Sdk/Model/ExpandRequest.cs +++ b/src/OpenFga.Sdk/Model/ExpandRequest.cs @@ -50,6 +50,7 @@ public ExpandRequest() { /// [DataMember(Name = "tuple_key", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("tuple_key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey TupleKey { get; set; } /// @@ -57,6 +58,7 @@ public ExpandRequest() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ExpandResponse.cs b/src/OpenFga.Sdk/Model/ExpandResponse.cs index a386b26..18d592d 100644 --- a/src/OpenFga.Sdk/Model/ExpandResponse.cs +++ b/src/OpenFga.Sdk/Model/ExpandResponse.cs @@ -44,6 +44,7 @@ public ExpandResponse() { /// [DataMember(Name = "tree", EmitDefaultValue = false)] [JsonPropertyName("tree")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public UsersetTree? Tree { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/GetStoreResponse.cs b/src/OpenFga.Sdk/Model/GetStoreResponse.cs index c716694..58684a4 100644 --- a/src/OpenFga.Sdk/Model/GetStoreResponse.cs +++ b/src/OpenFga.Sdk/Model/GetStoreResponse.cs @@ -50,6 +50,7 @@ public GetStoreResponse() { /// [DataMember(Name = "id", EmitDefaultValue = false)] [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Id { get; set; } /// @@ -57,6 +58,7 @@ public GetStoreResponse() { /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Name { get; set; } /// @@ -64,6 +66,7 @@ public GetStoreResponse() { /// [DataMember(Name = "created_at", EmitDefaultValue = false)] [JsonPropertyName("created_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? CreatedAt { get; set; } /// @@ -71,6 +74,7 @@ public GetStoreResponse() { /// [DataMember(Name = "updated_at", EmitDefaultValue = false)] [JsonPropertyName("updated_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? UpdatedAt { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/InternalErrorMessageResponse.cs b/src/OpenFga.Sdk/Model/InternalErrorMessageResponse.cs index c3c62a9..e7d74de 100644 --- a/src/OpenFga.Sdk/Model/InternalErrorMessageResponse.cs +++ b/src/OpenFga.Sdk/Model/InternalErrorMessageResponse.cs @@ -53,6 +53,7 @@ public InternalErrorMessageResponse() { /// [DataMember(Name = "message", EmitDefaultValue = false)] [JsonPropertyName("message")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Message { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Leaf.cs b/src/OpenFga.Sdk/Model/Leaf.cs index cba3ee4..6897a4d 100644 --- a/src/OpenFga.Sdk/Model/Leaf.cs +++ b/src/OpenFga.Sdk/Model/Leaf.cs @@ -48,6 +48,7 @@ public Leaf() { /// [DataMember(Name = "users", EmitDefaultValue = false)] [JsonPropertyName("users")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Users? Users { get; set; } /// @@ -55,6 +56,7 @@ public Leaf() { /// [DataMember(Name = "computed", EmitDefaultValue = false)] [JsonPropertyName("computed")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Computed? Computed { get; set; } /// @@ -62,6 +64,7 @@ public Leaf() { /// [DataMember(Name = "tupleToUserset", EmitDefaultValue = false)] [JsonPropertyName("tupleToUserset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public UsersetTreeTupleToUserset? TupleToUserset { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ListObjectsRequest.cs b/src/OpenFga.Sdk/Model/ListObjectsRequest.cs index 00355c6..a3c23bf 100644 --- a/src/OpenFga.Sdk/Model/ListObjectsRequest.cs +++ b/src/OpenFga.Sdk/Model/ListObjectsRequest.cs @@ -64,6 +64,7 @@ public ListObjectsRequest() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } /// @@ -71,6 +72,7 @@ public ListObjectsRequest() { /// [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("type")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Type { get; set; } /// @@ -78,6 +80,7 @@ public ListObjectsRequest() { /// [DataMember(Name = "relation", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("relation")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Relation { get; set; } /// @@ -85,6 +88,7 @@ public ListObjectsRequest() { /// [DataMember(Name = "user", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("user")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string User { get; set; } /// @@ -92,6 +96,7 @@ public ListObjectsRequest() { /// [DataMember(Name = "contextual_tuples", EmitDefaultValue = false)] [JsonPropertyName("contextual_tuples")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ContextualTupleKeys? ContextualTuples { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ListObjectsResponse.cs b/src/OpenFga.Sdk/Model/ListObjectsResponse.cs index 3dbc09b..8df4263 100644 --- a/src/OpenFga.Sdk/Model/ListObjectsResponse.cs +++ b/src/OpenFga.Sdk/Model/ListObjectsResponse.cs @@ -44,6 +44,7 @@ public ListObjectsResponse() { /// [DataMember(Name = "objects", EmitDefaultValue = false)] [JsonPropertyName("objects")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Objects { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ListStoresResponse.cs b/src/OpenFga.Sdk/Model/ListStoresResponse.cs index 815a443..fe2cb49 100644 --- a/src/OpenFga.Sdk/Model/ListStoresResponse.cs +++ b/src/OpenFga.Sdk/Model/ListStoresResponse.cs @@ -34,7 +34,7 @@ public ListStoresResponse() { /// Initializes a new instance of the class. /// /// stores. - /// continuationToken. + /// The continuation token will be empty if there are no more stores.. public ListStoresResponse(List stores = default(List), string continuationToken = default(string)) { this.Stores = stores; this.ContinuationToken = continuationToken; @@ -46,13 +46,16 @@ public ListStoresResponse() { /// [DataMember(Name = "stores", EmitDefaultValue = false)] [JsonPropertyName("stores")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Stores { get; set; } /// - /// Gets or Sets ContinuationToken + /// The continuation token will be empty if there are no more stores. /// + /// The continuation token will be empty if there are no more stores. [DataMember(Name = "continuation_token", EmitDefaultValue = false)] [JsonPropertyName("continuation_token")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? ContinuationToken { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Metadata.cs b/src/OpenFga.Sdk/Model/Metadata.cs index 1d340a5..1b5cc9d 100644 --- a/src/OpenFga.Sdk/Model/Metadata.cs +++ b/src/OpenFga.Sdk/Model/Metadata.cs @@ -44,6 +44,7 @@ public Metadata() { /// [DataMember(Name = "relations", EmitDefaultValue = false)] [JsonPropertyName("relations")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Dictionary? Relations { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Node.cs b/src/OpenFga.Sdk/Model/Node.cs index 7088275..d1301af 100644 --- a/src/OpenFga.Sdk/Model/Node.cs +++ b/src/OpenFga.Sdk/Model/Node.cs @@ -52,6 +52,7 @@ public Node() { /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Name { get; set; } /// @@ -59,6 +60,7 @@ public Node() { /// [DataMember(Name = "leaf", EmitDefaultValue = false)] [JsonPropertyName("leaf")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Leaf? Leaf { get; set; } /// @@ -66,6 +68,7 @@ public Node() { /// [DataMember(Name = "difference", EmitDefaultValue = false)] [JsonPropertyName("difference")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public UsersetTreeDifference? Difference { get; set; } /// @@ -73,6 +76,7 @@ public Node() { /// [DataMember(Name = "union", EmitDefaultValue = false)] [JsonPropertyName("union")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Nodes? Union { get; set; } /// @@ -80,6 +84,7 @@ public Node() { /// [DataMember(Name = "intersection", EmitDefaultValue = false)] [JsonPropertyName("intersection")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Nodes? Intersection { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Nodes.cs b/src/OpenFga.Sdk/Model/Nodes.cs index edaae28..9caaa01 100644 --- a/src/OpenFga.Sdk/Model/Nodes.cs +++ b/src/OpenFga.Sdk/Model/Nodes.cs @@ -44,6 +44,7 @@ public Nodes() { /// [DataMember(Name = "nodes", EmitDefaultValue = false)] [JsonPropertyName("nodes")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? _Nodes { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ObjectRelation.cs b/src/OpenFga.Sdk/Model/ObjectRelation.cs index cc343dc..c00f03e 100644 --- a/src/OpenFga.Sdk/Model/ObjectRelation.cs +++ b/src/OpenFga.Sdk/Model/ObjectRelation.cs @@ -46,6 +46,7 @@ public ObjectRelation() { /// [DataMember(Name = "object", EmitDefaultValue = false)] [JsonPropertyName("object")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Object { get; set; } /// @@ -53,6 +54,7 @@ public ObjectRelation() { /// [DataMember(Name = "relation", EmitDefaultValue = false)] [JsonPropertyName("relation")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Relation { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs b/src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs index 318b7fb..3e16c64 100644 --- a/src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs +++ b/src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs @@ -53,6 +53,7 @@ public PathUnknownErrorMessageResponse() { /// [DataMember(Name = "message", EmitDefaultValue = false)] [JsonPropertyName("message")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Message { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs b/src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs index 4b7f13b..028e5a2 100644 --- a/src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs +++ b/src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs @@ -46,6 +46,7 @@ public ReadAssertionsResponse() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } /// @@ -53,6 +54,7 @@ public ReadAssertionsResponse() { /// [DataMember(Name = "assertions", EmitDefaultValue = false)] [JsonPropertyName("assertions")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Assertions { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadAuthorizationModelResponse.cs b/src/OpenFga.Sdk/Model/ReadAuthorizationModelResponse.cs index 6799c42..1e104cd 100644 --- a/src/OpenFga.Sdk/Model/ReadAuthorizationModelResponse.cs +++ b/src/OpenFga.Sdk/Model/ReadAuthorizationModelResponse.cs @@ -44,6 +44,7 @@ public ReadAuthorizationModelResponse() { /// [DataMember(Name = "authorization_model", EmitDefaultValue = false)] [JsonPropertyName("authorization_model")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public AuthorizationModel? AuthorizationModel { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadAuthorizationModelsResponse.cs b/src/OpenFga.Sdk/Model/ReadAuthorizationModelsResponse.cs index b5553bf..e258f83 100644 --- a/src/OpenFga.Sdk/Model/ReadAuthorizationModelsResponse.cs +++ b/src/OpenFga.Sdk/Model/ReadAuthorizationModelsResponse.cs @@ -34,7 +34,7 @@ public ReadAuthorizationModelsResponse() { /// Initializes a new instance of the class. /// /// authorizationModels. - /// continuationToken. + /// The continuation token will be empty if there are no more models.. public ReadAuthorizationModelsResponse(List authorizationModels = default(List), string continuationToken = default(string)) { this.AuthorizationModels = authorizationModels; this.ContinuationToken = continuationToken; @@ -46,13 +46,16 @@ public ReadAuthorizationModelsResponse() { /// [DataMember(Name = "authorization_models", EmitDefaultValue = false)] [JsonPropertyName("authorization_models")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? AuthorizationModels { get; set; } /// - /// Gets or Sets ContinuationToken + /// The continuation token will be empty if there are no more models. /// + /// The continuation token will be empty if there are no more models. [DataMember(Name = "continuation_token", EmitDefaultValue = false)] [JsonPropertyName("continuation_token")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? ContinuationToken { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadChangesResponse.cs b/src/OpenFga.Sdk/Model/ReadChangesResponse.cs index 24fd11d..0be405b 100644 --- a/src/OpenFga.Sdk/Model/ReadChangesResponse.cs +++ b/src/OpenFga.Sdk/Model/ReadChangesResponse.cs @@ -34,7 +34,7 @@ public ReadChangesResponse() { /// Initializes a new instance of the class. /// /// changes. - /// continuationToken. + /// The continuation token will be identical if there are no new changes.. public ReadChangesResponse(List changes = default(List), string continuationToken = default(string)) { this.Changes = changes; this.ContinuationToken = continuationToken; @@ -46,13 +46,16 @@ public ReadChangesResponse() { /// [DataMember(Name = "changes", EmitDefaultValue = false)] [JsonPropertyName("changes")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Changes { get; set; } /// - /// Gets or Sets ContinuationToken + /// The continuation token will be identical if there are no new changes. /// + /// The continuation token will be identical if there are no new changes. [DataMember(Name = "continuation_token", EmitDefaultValue = false)] [JsonPropertyName("continuation_token")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? ContinuationToken { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadRequest.cs b/src/OpenFga.Sdk/Model/ReadRequest.cs index 0f92d9e..9839daf 100644 --- a/src/OpenFga.Sdk/Model/ReadRequest.cs +++ b/src/OpenFga.Sdk/Model/ReadRequest.cs @@ -48,6 +48,7 @@ public ReadRequest() { /// [DataMember(Name = "tuple_key", EmitDefaultValue = false)] [JsonPropertyName("tuple_key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey? TupleKey { get; set; } /// @@ -55,6 +56,7 @@ public ReadRequest() { /// [DataMember(Name = "page_size", EmitDefaultValue = false)] [JsonPropertyName("page_size")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public int? PageSize { get; set; } /// @@ -62,6 +64,7 @@ public ReadRequest() { /// [DataMember(Name = "continuation_token", EmitDefaultValue = false)] [JsonPropertyName("continuation_token")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? ContinuationToken { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ReadResponse.cs b/src/OpenFga.Sdk/Model/ReadResponse.cs index fb28688..c4586f7 100644 --- a/src/OpenFga.Sdk/Model/ReadResponse.cs +++ b/src/OpenFga.Sdk/Model/ReadResponse.cs @@ -34,7 +34,7 @@ public ReadResponse() { /// Initializes a new instance of the class. /// /// tuples. - /// continuationToken. + /// The continuation token will be empty if there are no more tuples.. public ReadResponse(List tuples = default(List), string continuationToken = default(string)) { this.Tuples = tuples; this.ContinuationToken = continuationToken; @@ -46,13 +46,16 @@ public ReadResponse() { /// [DataMember(Name = "tuples", EmitDefaultValue = false)] [JsonPropertyName("tuples")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Tuples { get; set; } /// - /// Gets or Sets ContinuationToken + /// The continuation token will be empty if there are no more tuples. /// + /// The continuation token will be empty if there are no more tuples. [DataMember(Name = "continuation_token", EmitDefaultValue = false)] [JsonPropertyName("continuation_token")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? ContinuationToken { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/RelationMetadata.cs b/src/OpenFga.Sdk/Model/RelationMetadata.cs index 2865a89..39c9424 100644 --- a/src/OpenFga.Sdk/Model/RelationMetadata.cs +++ b/src/OpenFga.Sdk/Model/RelationMetadata.cs @@ -44,6 +44,7 @@ public RelationMetadata() { /// [DataMember(Name = "directly_related_user_types", EmitDefaultValue = false)] [JsonPropertyName("directly_related_user_types")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? DirectlyRelatedUserTypes { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/RelationReference.cs b/src/OpenFga.Sdk/Model/RelationReference.cs index 7e47874..53670d0 100644 --- a/src/OpenFga.Sdk/Model/RelationReference.cs +++ b/src/OpenFga.Sdk/Model/RelationReference.cs @@ -52,6 +52,7 @@ public RelationReference() { /// [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("type")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Type { get; set; } /// @@ -59,6 +60,7 @@ public RelationReference() { /// [DataMember(Name = "relation", EmitDefaultValue = false)] [JsonPropertyName("relation")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Relation { get; set; } /// @@ -66,6 +68,7 @@ public RelationReference() { /// [DataMember(Name = "wildcard", EmitDefaultValue = false)] [JsonPropertyName("wildcard")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Object? Wildcard { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Status.cs b/src/OpenFga.Sdk/Model/Status.cs index 2528d27..908bccb 100644 --- a/src/OpenFga.Sdk/Model/Status.cs +++ b/src/OpenFga.Sdk/Model/Status.cs @@ -48,6 +48,7 @@ public Status() { /// [DataMember(Name = "code", EmitDefaultValue = false)] [JsonPropertyName("code")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public int? Code { get; set; } /// @@ -55,6 +56,7 @@ public Status() { /// [DataMember(Name = "message", EmitDefaultValue = false)] [JsonPropertyName("message")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Message { get; set; } /// @@ -62,6 +64,7 @@ public Status() { /// [DataMember(Name = "details", EmitDefaultValue = false)] [JsonPropertyName("details")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Details { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Store.cs b/src/OpenFga.Sdk/Model/Store.cs index d2a204f..c8a161a 100644 --- a/src/OpenFga.Sdk/Model/Store.cs +++ b/src/OpenFga.Sdk/Model/Store.cs @@ -52,6 +52,7 @@ public Store() { /// [DataMember(Name = "id", EmitDefaultValue = false)] [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Id { get; set; } /// @@ -59,6 +60,7 @@ public Store() { /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Name { get; set; } /// @@ -66,6 +68,7 @@ public Store() { /// [DataMember(Name = "created_at", EmitDefaultValue = false)] [JsonPropertyName("created_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? CreatedAt { get; set; } /// @@ -73,6 +76,7 @@ public Store() { /// [DataMember(Name = "updated_at", EmitDefaultValue = false)] [JsonPropertyName("updated_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? UpdatedAt { get; set; } /// @@ -80,6 +84,7 @@ public Store() { /// [DataMember(Name = "deleted_at", EmitDefaultValue = false)] [JsonPropertyName("deleted_at")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? DeletedAt { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Tuple.cs b/src/OpenFga.Sdk/Model/Tuple.cs index d783f54..7038563 100644 --- a/src/OpenFga.Sdk/Model/Tuple.cs +++ b/src/OpenFga.Sdk/Model/Tuple.cs @@ -46,6 +46,7 @@ public Tuple() { /// [DataMember(Name = "key", EmitDefaultValue = false)] [JsonPropertyName("key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey? Key { get; set; } /// @@ -53,6 +54,7 @@ public Tuple() { /// [DataMember(Name = "timestamp", EmitDefaultValue = false)] [JsonPropertyName("timestamp")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? Timestamp { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/TupleChange.cs b/src/OpenFga.Sdk/Model/TupleChange.cs index f73c940..a7c5633 100644 --- a/src/OpenFga.Sdk/Model/TupleChange.cs +++ b/src/OpenFga.Sdk/Model/TupleChange.cs @@ -55,6 +55,7 @@ public TupleChange() { /// [DataMember(Name = "tuple_key", EmitDefaultValue = false)] [JsonPropertyName("tuple_key")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKey? TupleKey { get; set; } /// @@ -62,6 +63,7 @@ public TupleChange() { /// [DataMember(Name = "timestamp", EmitDefaultValue = false)] [JsonPropertyName("timestamp")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime? Timestamp { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/TupleKey.cs b/src/OpenFga.Sdk/Model/TupleKey.cs index a744bc9..74100a7 100644 --- a/src/OpenFga.Sdk/Model/TupleKey.cs +++ b/src/OpenFga.Sdk/Model/TupleKey.cs @@ -48,6 +48,7 @@ public TupleKey() { /// [DataMember(Name = "object", EmitDefaultValue = false)] [JsonPropertyName("object")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Object { get; set; } /// @@ -55,6 +56,7 @@ public TupleKey() { /// [DataMember(Name = "relation", EmitDefaultValue = false)] [JsonPropertyName("relation")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Relation { get; set; } /// @@ -62,6 +64,7 @@ public TupleKey() { /// [DataMember(Name = "user", EmitDefaultValue = false)] [JsonPropertyName("user")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? User { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/TupleKeys.cs b/src/OpenFga.Sdk/Model/TupleKeys.cs index ec13287..877f395 100644 --- a/src/OpenFga.Sdk/Model/TupleKeys.cs +++ b/src/OpenFga.Sdk/Model/TupleKeys.cs @@ -48,6 +48,7 @@ public TupleKeys() { /// [DataMember(Name = "tuple_keys", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("tuple_keys")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List _TupleKeys { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/TupleToUserset.cs b/src/OpenFga.Sdk/Model/TupleToUserset.cs index 6bf1b17..5c8b6c5 100644 --- a/src/OpenFga.Sdk/Model/TupleToUserset.cs +++ b/src/OpenFga.Sdk/Model/TupleToUserset.cs @@ -46,6 +46,7 @@ public TupleToUserset() { /// [DataMember(Name = "tupleset", EmitDefaultValue = false)] [JsonPropertyName("tupleset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ObjectRelation? Tupleset { get; set; } /// @@ -53,6 +54,7 @@ public TupleToUserset() { /// [DataMember(Name = "computedUserset", EmitDefaultValue = false)] [JsonPropertyName("computedUserset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ObjectRelation? ComputedUserset { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/TypeDefinition.cs b/src/OpenFga.Sdk/Model/TypeDefinition.cs index 84725b0..ed4001d 100644 --- a/src/OpenFga.Sdk/Model/TypeDefinition.cs +++ b/src/OpenFga.Sdk/Model/TypeDefinition.cs @@ -52,6 +52,7 @@ public TypeDefinition() { /// [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("type")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Type { get; set; } /// @@ -59,6 +60,7 @@ public TypeDefinition() { /// [DataMember(Name = "relations", EmitDefaultValue = false)] [JsonPropertyName("relations")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Dictionary? Relations { get; set; } /// @@ -66,6 +68,7 @@ public TypeDefinition() { /// [DataMember(Name = "metadata", EmitDefaultValue = false)] [JsonPropertyName("metadata")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Metadata? Metadata { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Users.cs b/src/OpenFga.Sdk/Model/Users.cs index 2b4a6c3..344a212 100644 --- a/src/OpenFga.Sdk/Model/Users.cs +++ b/src/OpenFga.Sdk/Model/Users.cs @@ -44,6 +44,7 @@ public Users() { /// [DataMember(Name = "users", EmitDefaultValue = false)] [JsonPropertyName("users")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? _Users { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Userset.cs b/src/OpenFga.Sdk/Model/Userset.cs index 1673ce8..2cd50ff 100644 --- a/src/OpenFga.Sdk/Model/Userset.cs +++ b/src/OpenFga.Sdk/Model/Userset.cs @@ -55,6 +55,7 @@ public Userset() { /// A DirectUserset is a sentinel message for referencing the direct members specified by an object/relation mapping. [DataMember(Name = "this", EmitDefaultValue = false)] [JsonPropertyName("this")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Object? This { get; set; } /// @@ -62,6 +63,7 @@ public Userset() { /// [DataMember(Name = "computedUserset", EmitDefaultValue = false)] [JsonPropertyName("computedUserset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ObjectRelation? ComputedUserset { get; set; } /// @@ -69,6 +71,7 @@ public Userset() { /// [DataMember(Name = "tupleToUserset", EmitDefaultValue = false)] [JsonPropertyName("tupleToUserset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleToUserset? TupleToUserset { get; set; } /// @@ -76,6 +79,7 @@ public Userset() { /// [DataMember(Name = "union", EmitDefaultValue = false)] [JsonPropertyName("union")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Usersets? Union { get; set; } /// @@ -83,6 +87,7 @@ public Userset() { /// [DataMember(Name = "intersection", EmitDefaultValue = false)] [JsonPropertyName("intersection")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Usersets? Intersection { get; set; } /// @@ -90,6 +95,7 @@ public Userset() { /// [DataMember(Name = "difference", EmitDefaultValue = false)] [JsonPropertyName("difference")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Difference? Difference { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/UsersetTree.cs b/src/OpenFga.Sdk/Model/UsersetTree.cs index d09a5ac..100564e 100644 --- a/src/OpenFga.Sdk/Model/UsersetTree.cs +++ b/src/OpenFga.Sdk/Model/UsersetTree.cs @@ -44,6 +44,7 @@ public UsersetTree() { /// [DataMember(Name = "root", EmitDefaultValue = false)] [JsonPropertyName("root")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Node? Root { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/UsersetTreeDifference.cs b/src/OpenFga.Sdk/Model/UsersetTreeDifference.cs index 948f865..ee94730 100644 --- a/src/OpenFga.Sdk/Model/UsersetTreeDifference.cs +++ b/src/OpenFga.Sdk/Model/UsersetTreeDifference.cs @@ -46,6 +46,7 @@ public UsersetTreeDifference() { /// [DataMember(Name = "base", EmitDefaultValue = false)] [JsonPropertyName("base")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Node? Base { get; set; } /// @@ -53,6 +54,7 @@ public UsersetTreeDifference() { /// [DataMember(Name = "subtract", EmitDefaultValue = false)] [JsonPropertyName("subtract")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public Node? Subtract { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/UsersetTreeTupleToUserset.cs b/src/OpenFga.Sdk/Model/UsersetTreeTupleToUserset.cs index 5fe3f7e..b40d159 100644 --- a/src/OpenFga.Sdk/Model/UsersetTreeTupleToUserset.cs +++ b/src/OpenFga.Sdk/Model/UsersetTreeTupleToUserset.cs @@ -46,6 +46,7 @@ public UsersetTreeTupleToUserset() { /// [DataMember(Name = "tupleset", EmitDefaultValue = false)] [JsonPropertyName("tupleset")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Tupleset { get; set; } /// @@ -53,6 +54,7 @@ public UsersetTreeTupleToUserset() { /// [DataMember(Name = "computed", EmitDefaultValue = false)] [JsonPropertyName("computed")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Computed { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/Usersets.cs b/src/OpenFga.Sdk/Model/Usersets.cs index 814e441..72040df 100644 --- a/src/OpenFga.Sdk/Model/Usersets.cs +++ b/src/OpenFga.Sdk/Model/Usersets.cs @@ -44,6 +44,7 @@ public Usersets() { /// [DataMember(Name = "child", EmitDefaultValue = false)] [JsonPropertyName("child")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List? Child { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/ValidationErrorMessageResponse.cs b/src/OpenFga.Sdk/Model/ValidationErrorMessageResponse.cs index 7b903ea..99788c1 100644 --- a/src/OpenFga.Sdk/Model/ValidationErrorMessageResponse.cs +++ b/src/OpenFga.Sdk/Model/ValidationErrorMessageResponse.cs @@ -53,6 +53,7 @@ public ValidationErrorMessageResponse() { /// [DataMember(Name = "message", EmitDefaultValue = false)] [JsonPropertyName("message")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? Message { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/WriteAssertionsRequest.cs b/src/OpenFga.Sdk/Model/WriteAssertionsRequest.cs index 8fba2be..d67b1eb 100644 --- a/src/OpenFga.Sdk/Model/WriteAssertionsRequest.cs +++ b/src/OpenFga.Sdk/Model/WriteAssertionsRequest.cs @@ -48,6 +48,7 @@ public WriteAssertionsRequest() { /// [DataMember(Name = "assertions", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("assertions")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List Assertions { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/WriteAuthorizationModelRequest.cs b/src/OpenFga.Sdk/Model/WriteAuthorizationModelRequest.cs index 40ca2cb..b51cbc2 100644 --- a/src/OpenFga.Sdk/Model/WriteAuthorizationModelRequest.cs +++ b/src/OpenFga.Sdk/Model/WriteAuthorizationModelRequest.cs @@ -50,6 +50,7 @@ public WriteAuthorizationModelRequest() { /// [DataMember(Name = "type_definitions", IsRequired = true, EmitDefaultValue = false)] [JsonPropertyName("type_definitions")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List TypeDefinitions { get; set; } /// @@ -57,6 +58,7 @@ public WriteAuthorizationModelRequest() { /// [DataMember(Name = "schema_version", EmitDefaultValue = false)] [JsonPropertyName("schema_version")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? SchemaVersion { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/WriteAuthorizationModelResponse.cs b/src/OpenFga.Sdk/Model/WriteAuthorizationModelResponse.cs index 9100a6a..bce62fe 100644 --- a/src/OpenFga.Sdk/Model/WriteAuthorizationModelResponse.cs +++ b/src/OpenFga.Sdk/Model/WriteAuthorizationModelResponse.cs @@ -44,6 +44,7 @@ public WriteAuthorizationModelResponse() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } /// diff --git a/src/OpenFga.Sdk/Model/WriteRequest.cs b/src/OpenFga.Sdk/Model/WriteRequest.cs index a9b8848..c9c0d5f 100644 --- a/src/OpenFga.Sdk/Model/WriteRequest.cs +++ b/src/OpenFga.Sdk/Model/WriteRequest.cs @@ -48,6 +48,7 @@ public WriteRequest() { /// [DataMember(Name = "writes", EmitDefaultValue = false)] [JsonPropertyName("writes")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKeys? Writes { get; set; } /// @@ -55,6 +56,7 @@ public WriteRequest() { /// [DataMember(Name = "deletes", EmitDefaultValue = false)] [JsonPropertyName("deletes")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public TupleKeys? Deletes { get; set; } /// @@ -62,6 +64,7 @@ public WriteRequest() { /// [DataMember(Name = "authorization_model_id", EmitDefaultValue = false)] [JsonPropertyName("authorization_model_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string? AuthorizationModelId { get; set; } ///