Skip to content

Commit

Permalink
[ruby|client] Fix unmarshalling errors of enums inside other objects
Browse files Browse the repository at this point in the history
Ruby|Client autogenerated model classes for Enums do not expose openapi_one_of
method. Instead they expose openapi_any_of method like:

      # List of class defined in anyOf (OpenAPI v3)
      def openapi_any_of
        [
          :String
        ]
      end

Both types (objects and enums) do respond to build() method.
  • Loading branch information
isimluk committed Oct 25, 2023
1 parent 0aff1a6 commit 4ee5b78
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
else # model
# models (e.g. Pet) or oneOf
klass = {{moduleName}}.const_get(type)
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end

Expand Down

0 comments on commit 4ee5b78

Please sign in to comment.