Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Fixed defaults primitive default-value handling during code generation for all languages
- Ruby: added composed type (union/intersection) support to the factory, serializer and deserializer bodies, and stopped emitting composed type wrappers as inner classes. Un-suppresses the Twitter integration test. [kiota-abstractions-ruby#73](https://github.com/microsoft/kiota-abstractions-ruby/issues/73) [#1816](https://github.com/microsoft/kiota/issues/1816)
- Ruby: `initialize` is now a reserved name. An API member called `initialize` previously generated a second `def initialize`, redefining the constructor; it is now escaped.
- Ruby: removed the blank line emitted at the start of every generated class body.
- Ruby: moved the runtime gem dependencies to 0.19.0, the first release able to serialize a primitive composed type member and to tell which member a payload holds.
- Fixed plugin manifest generation to omit unsafe `oauth_card_path` file references that could resolve outside the plugin package.
- Bumped `Microsoft.OpenApi` and `Microsoft.OpenApi.YamlReader` to 3.10.0.
- Numeric scalar unions with a format (e.g. `type: ["integer", "string"]` with `format: int32`, as emitted by ASP.NET Core's OpenAPI 3.1 generator under System.Text.Json's default `JsonNumberHandling.AllowReadingFromString`) now map to the numeric type instead of degrading to `UntypedNode`. [#6541](https://github.com/microsoft/kiota/issues/6541)
Expand Down
4 changes: 0 additions & 4 deletions it/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@
},
"https://api.twitter.com/2/openapi.json": {
"Suppressions": [
Comment thread
baywet marked this conversation as resolved.
{
"Language": "ruby",
"Rationale": "https://github.com/microsoft/kiota-abstractions-ruby/issues/73"
},
{
"Language": "dart",
"Rationale": "dart analyze fails on unnecessary_null_comparison for primitive binary union media models - https://github.com/microsoft/kiota/issues/7997"
Expand Down
5 changes: 5 additions & 0 deletions it/ruby/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ Naming/VariableNumber:
Metrics/CyclomaticComplexity:
Enabled: false

# Composed type factories, serializers and deserializers branch once per union member,
# so their complexity tracks the arity of the union rather than any avoidable nesting
Metrics/PerceivedComplexity:
Enabled: false

# Generated factory methods may just delegate to super
Lint/UselessMethodDefinition:
Enabled: false
8 changes: 4 additions & 4 deletions it/ruby/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"

gem "microsoft_kiota_abstractions", "~> 0.15.1"
gem "microsoft_kiota_abstractions", "~> 0.19.0"

gem "microsoft_kiota_faraday", "~> 0.16.0"
gem "microsoft_kiota_faraday", "~> 0.19.0"

gem "microsoft_kiota_serialization_json", "~> 0.10.0"
gem "microsoft_kiota_serialization_json", "~> 0.19.0"

gem "microsoft_kiota_authentication_oauth", "~> 0.9.0"
gem "microsoft_kiota_authentication_oauth", "~> 0.19.0"
3 changes: 2 additions & 1 deletion src/Kiota.Builder/Refiners/RubyRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public override Task RefineAsync(CodeNamespace generatedCode, CancellationToken
UpdateReferencesToDisambiguatedClasses(generatedCode, classesToDisambiguate, suffix);
ConvertUnionTypesToWrapper(generatedCode,
_configuration.UsesBackingStore,
static s => s
static s => s,
false
);
var reservedNamesProvider = new RubyReservedNamesProvider();
CorrectNames(generatedCode, s =>
Expand Down
2 changes: 2 additions & 0 deletions src/Kiota.Builder/Refiners/RubyReservedNamesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class RubyReservedNamesProvider : IReservedNamesProvider
"BaseRequestBuilder",
"ObjectId",
"object_id",
// Object protocol: a generated member of this name would redefine the constructor
"initialize",
});
public HashSet<string> ReservedNames => _reservedNames.Value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit
if (codeElement.Parent is CodeClass parentClass)
conventions.WriteShortDescription(parentClass, writer);
writer.StartBlock($"class {codeElement.Name.ToFirstCharacterUpperCase()}{derivation}");
var mixins = !codeElement.Implements.Any() ? string.Empty : $"include {codeElement.Implements.Select(static x => x.Name).Aggregate(static (x, y) => x + ", " + y)}";
writer.WriteLine($"{mixins}");
// writing an empty mixin line would leave a blank (indent-only) first line in the class body
if (codeElement.Implements.Any())
writer.WriteLine($"include {codeElement.Implements.Select(static x => x.Name).Aggregate(static (x, y) => x + ", " + y)}");
}
}
Loading
Loading