Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove reserved properties from function signatures #4205

Merged
merged 4 commits into from
Aug 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ export const FieldsetProperty = new Property({
type: GenericClassReference,
isOptional: true
});

export declare namespace SerializableObject {
export type Init = Omit<Class_.Init, "functions" | "includeInitializer" | "expressions">;
}
export class SerializableObject extends Class_ {
public static INTERNAL_FIELDS = [AdditionalPropertiesProperty.name, FieldsetProperty.name];

constructor(init: SerializableObject.Init) {
super({
...init,
Expand Down
4 changes: 4 additions & 0 deletions generators/ruby/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.8.2] - 2024-08-05

- Fix: The generated endpoint functions no long include object utilities such as `_field_set` or `additional_properties`.

## [0.8.1] - 2024-07-22

- Fix: Nested `hash` types are recursively resolved in `from_json` such that they come back as true hashes, as opposed to structs
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.1
0.8.2
6 changes: 6 additions & 0 deletions generators/ruby/sdk/src/utils/EndpointGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
LiteralClassReference,
Parameter,
Property,
SerializableObject,
StringClassReference,
Variable,
VariableType,
Expand Down Expand Up @@ -273,6 +274,11 @@ export class EndpointGenerator {
}
});

// Remove reserved properties from the function signature
this.bodyAsProperties = this.bodyAsProperties.filter(
(prop) => !SerializableObject.INTERNAL_FIELDS.includes(prop.name)
);

this.streamProcessingBlock = this.isStreamingResponse()
? new Parameter({
name: "on_data",
Expand Down
15 changes: 2 additions & 13 deletions seed/ruby-sdk/extends/lib/fern_extends.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading