Skip to content

[pull] master from OpenAPITools:master - #812

Merged
pull[bot] merged 1 commit into
transparencies:masterfrom
OpenAPITools:master
Sep 25, 2026
Merged

pull[bot] merged 1 commit into
transparencies:masterfrom
OpenAPITools:master

Conversation

@pull

@pull pull Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

…llOf parent (#24892)

* [ruby] fix: build_from_hash maps attributes inherited from allOf parents

A discriminator allOf child generates as a real subclass, but
build_from_hash iterated only openapi_types/attribute_map - class methods
that dispatch on the child class in every frame of the ancestry, so a
parent's attributes were never mapped from the wire hash: a required
inherited attribute made deserialization raise ArgumentError, an optional
one came back silently nil. The pre-existing super(attributes) call could
not help: its result was discarded, and it iterated the child's own types
anyway.

Walk the ancestry merging each ancestor's openapi_types and attribute_map
(the child wins on a name clash) and drop the discarded-result super
call. RubyClientCodegenTest asserts the walk on the generated two-level
Lizard < Reptile < Pet fixture (fails without the template change), and
the three petstore custom base_object specs now deserialize a Cat that
carries its parent's attributes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcwZ1arjLZNpetHz2a3TJz

* update ruby samples

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcwZ1arjLZNpetHz2a3TJz

* [ruby] fix: to_hash loses the same inherited attributes

The serialization direction has the identical defect: attribute_map and
openapi_nullable dispatch on the child class in every ancestor frame, so
the inherited super chain only repeated the child's own attributes and a
round-tripped allOf child lost its parent's fields again on the way out.
Walk the ancestry the same way build_from_hash now does; for a model
without a generated parent the walk does not run and the output is
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcwZ1arjLZNpetHz2a3TJz

* update ruby samples

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcwZ1arjLZNpetHz2a3TJz

* [ruby] fix: ancestor nullability defers to a child's redeclaration, and Set loads

Two findings from review: the merged-nullable union let a parent's
nullable flag survive a child redeclaring the attribute as non-nullable -
an ancestor's entry now only applies to attributes no nearer class
declares - and the walk evaluates openapi_nullable eagerly for every
to_hash call, so the generated models require 'set' explicitly instead of
leaning on the Set builtin autoload rubies before 3.2 do not have.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcwZ1arjLZNpetHz2a3TJz

* [ruby] fix: only hand an initializer the attributes it accepts, and load Set only where used

build_from_hash and to_hash now take their attribute map from
acceptable_attribute_map, the same map the generated initializer
validates against. For a generated allOf child it is identical to the
ancestry walk; for a consumer subclass that narrows attribute_map it
keeps the attributes to the ones the subclass accepts, as on master,
instead of passing its parent's fields to an initializer that rejects
them. The ancestry walk remains for openapi_types and openapi_nullable.

require 'set' is emitted only for generic models, the only ones whose
openapi_nullable uses Set; enum classes and oneOf/anyOf modules no
longer carry it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [ruby] refactor: merge inherited types and nullability with the acceptable_attribute_map idiom

acceptable_openapi_types and acceptable_openapi_nullable merge along the
allOf ancestry the way acceptable_attribute_map already does, so
build_from_hash and to_hash lose their while loops and the require 'set'
block. Also drops the redundant map.key? guard, shortens the generated
comments and specs, and reverts the stray ruby-faraday Gemfile.lock bump.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* [ruby] fix: models whose superclass is not a generated model do not delegate to it

An alias to an array (ArrayAlias < Array) has a parent, so the ancestry
helpers and the initializer called superclass methods Array does not
provide. Gate the delegation on parentModel, so every model has a base case.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators Sep 25, 2026
@pull pull Bot added the ⤵️ pull label Sep 25, 2026
@pull
pull Bot merged commit 9d0828b into transparencies:master Sep 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant