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

Add description for JSON representation of BigDecimal #156

Open
smcgivern opened this issue Jan 13, 2016 · 1 comment
Open

Add description for JSON representation of BigDecimal #156

smcgivern opened this issue Jan 13, 2016 · 1 comment

Comments

@smcgivern
Copy link
Contributor

In our cloud pricing API, a FixedCharge has a price, which is a BigDecimal. We added a description for this by monkey-patching the Attributor type:

module Attributor
 class BigDecimal
   def self.describe(root = false, example: nil)
     h = super
     h[:description] = "This is a floating point number encoded as a JSON string in order to preserve precision."
     h
   end
 end
end

It seems like it would make sense to have a description by default (it doesn't have to be this one). Does that belong in Attributor or further up the chain (this is a Praxis app)?

@careo and @blanquer interested in what you think.

@blanquer
Copy link
Contributor

yes, this is related to #79 and #168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants