You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed, that there are many attributes defined in the openapi specification file which are not accessible through the ruby models. As a user of this gem I would like to be able to access all attributes from the API response though.
The match_open_api_definition matcher can be used to show the difference like this:
RSpec::Matchers.define:match_open_api_definitiondo |scope,model,options={}|
# [...]matchdo |actual_model|
returnfalseifmodel_node.nil?model_attributes=defined_attributes(actual_model)(model_attributes - specified_attributes | specified_attributes - model_attributes).empty?endfailure_messagedo |actual_model|
ifmodel_node.nil?<<~MESSAGE Specification not found for #{actual_model}. I was looking for: #{schema_path}. Available specifications:#{schemas.keys} MESSAGEelse<<~MESSAGE expected that the model #{actual_model} would only define attributes defined in the open_api definition, but there are attributes in the model that are not in the specification. The attributes which are used in the model but which are not in the specification are:#{(defined_attributes(actual_model) - specified_attributes).sort} The attributes which are not used in the model but which are in the specification are:#{(specified_attributes - defined_attributes(actual_model)).sort} The attributes defined in the model are:#{defined_attributes(actual_model).sort} The attributes defined in the specification are:#{specified_attributes.sort} MESSAGEendendend
The text was updated successfully, but these errors were encountered:
I noticed, that there are many attributes defined in the openapi specification file which are not accessible through the ruby models. As a user of this gem I would like to be able to access all attributes from the API response though.
The
match_open_api_definition
matcher can be used to show the difference like this:The text was updated successfully, but these errors were encountered: