-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for modular models metadata (#53)
<!-- Thanks for opening a PR! Here are some quick tips: If this is your first time contributing, [read our Contributing Guidelines](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md) to learn how to create an acceptable PR for this repo. By submitting a PR to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/.github/blob/main/CODE_OF_CONDUCT.md) If your PR is under active development, please submit it as a "draft". Once it's ready, open it up for review. --> <!-- Provide a brief summary of the changes --> ## Description <!-- Provide a detailed description of the changes --> This PR merges the latest upstream changes from the `sdk-generator`, introducing support for modular models metadata, as contributed in openfga/api@66b9e5c ## References <!-- Provide a list of any applicable references here (GitHub Issue, [OpenFGA RFC](https://github.com/openfga/rfcs), other PRs, etc..) --> ## Review Checklist - [x] I have clicked on ["allow edits by maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). - [x] I have added documentation for new/changed functionality in this PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev) [Provide a link to any relevant PRs in the references section above] - [x] The correct base branch is being used, if not `main` - [ ] I have added tests to validate that the change in functionality is working as expected
- Loading branch information
Showing
12 changed files
with
401 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# OpenFga.Sdk.Model.ConditionMetadata | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**Module** | **string** | | [optional] | ||
**SourceInfo** | [**SourceInfo**](SourceInfo.md) | | [optional] | ||
|
||
[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# OpenFga.Sdk.Model.SourceInfo | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**File** | **string** | | [optional] | ||
|
||
[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// | ||
// OpenFGA/.NET SDK for OpenFGA | ||
// | ||
// API version: 0.1 | ||
// Website: https://openfga.dev | ||
// Documentation: https://openfga.dev/docs | ||
// Support: https://openfga.dev/community | ||
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE) | ||
// | ||
// NOTE: This file was auto generated. DO NOT EDIT. | ||
// | ||
|
||
|
||
using System.ComponentModel.DataAnnotations; | ||
using System.Runtime.Serialization; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenFga.Sdk.Model { | ||
/// <summary> | ||
/// ConditionMetadata | ||
/// </summary> | ||
[DataContract(Name = "ConditionMetadata")] | ||
public partial class ConditionMetadata : IEquatable<ConditionMetadata>, IValidatableObject { | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ConditionMetadata" /> class. | ||
/// </summary> | ||
[JsonConstructor] | ||
public ConditionMetadata() { | ||
this.AdditionalProperties = new Dictionary<string, object>(); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ConditionMetadata" /> class. | ||
/// </summary> | ||
/// <param name="module">module.</param> | ||
/// <param name="sourceInfo">sourceInfo.</param> | ||
public ConditionMetadata(string module = default(string), SourceInfo sourceInfo = default(SourceInfo)) { | ||
this.Module = module; | ||
this.SourceInfo = sourceInfo; | ||
this.AdditionalProperties = new Dictionary<string, object>(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or Sets Module | ||
/// </summary> | ||
[DataMember(Name = "module", EmitDefaultValue = false)] | ||
[JsonPropertyName("module")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
public string? Module { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets SourceInfo | ||
/// </summary> | ||
[DataMember(Name = "source_info", EmitDefaultValue = false)] | ||
[JsonPropertyName("source_info")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
public SourceInfo? SourceInfo { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets additional properties | ||
/// </summary> | ||
[JsonExtensionData] | ||
public IDictionary<string, object> AdditionalProperties { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Returns the JSON string presentation of the object | ||
/// </summary> | ||
/// <returns>JSON string presentation of the object</returns> | ||
public virtual string ToJson() { | ||
return JsonSerializer.Serialize(this); | ||
} | ||
|
||
/// <summary> | ||
/// Builds a ConditionMetadata from the JSON string presentation of the object | ||
/// </summary> | ||
/// <returns>ConditionMetadata</returns> | ||
public static ConditionMetadata FromJson(string jsonString) { | ||
return JsonSerializer.Deserialize<ConditionMetadata>(jsonString) ?? throw new InvalidOperationException(); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if objects are equal | ||
/// </summary> | ||
/// <param name="input">Object to be compared</param> | ||
/// <returns>Boolean</returns> | ||
public override bool Equals(object input) { | ||
return this.Equals(input as ConditionMetadata); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if ConditionMetadata instances are equal | ||
/// </summary> | ||
/// <param name="input">Instance of ConditionMetadata to be compared</param> | ||
/// <returns>Boolean</returns> | ||
public bool Equals(ConditionMetadata input) { | ||
if (input == null) { | ||
return false; | ||
} | ||
return | ||
( | ||
this.Module == input.Module || | ||
(this.Module != null && | ||
this.Module.Equals(input.Module)) | ||
) && | ||
( | ||
this.SourceInfo == input.SourceInfo || | ||
(this.SourceInfo != null && | ||
this.SourceInfo.Equals(input.SourceInfo)) | ||
) | ||
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the hash code | ||
/// </summary> | ||
/// <returns>Hash code</returns> | ||
public override int GetHashCode() { | ||
unchecked // Overflow is fine, just wrap | ||
{ | ||
int hashCode = 9661; | ||
if (this.Module != null) { | ||
hashCode = (hashCode * 9923) + this.Module.GetHashCode(); | ||
} | ||
if (this.SourceInfo != null) { | ||
hashCode = (hashCode * 9923) + this.SourceInfo.GetHashCode(); | ||
} | ||
if (this.AdditionalProperties != null) { | ||
hashCode = (hashCode * 9923) + this.AdditionalProperties.GetHashCode(); | ||
} | ||
return hashCode; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// To validate all properties of the instance | ||
/// </summary> | ||
/// <param name="validationContext">Validation context</param> | ||
/// <returns>Validation Result</returns> | ||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { | ||
yield break; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.