fhir-crucible / fhir_models

FHIR Resource Models
Apache License 2.0
87 stars 26 forks source link

Fix serialization for fhir_models nested in arrays and hashes #73

Closed jason-crowley closed 3 years ago

jason-crowley commented 4 years ago

Before, evaluating [FHIR::Patient.new].to_json would raise this exception:

2.5.6 :005 > [FHIR::Patient.new].to_json
Traceback (most recent call last):
        4: from /Users/crowleyj/.rvm/rubies/ruby-2.5.6/bin/irb:11:in `<main>'
        3: from (irb):5
        2: from (irb):5:in `to_json'
        1: from /Users/crowleyj/.rvm/gems/ruby-2.5.6/gems/fhir_models-4.1.0/lib/fhir_models/bootstrap/json.rb:9:in `to_json'
ArgumentError (wrong number of arguments (given 1, expected 0))

This PR fixes that by adding an optional argument to the to_json method. See here for more details.