Giter VIP home page Giter VIP logo

Comments (7)

richmolj avatar richmolj commented on May 18, 2024

Answered in Slack chat - and fixed! Thanks for raising it @aguirrel

from graphiti.

hector avatar hector commented on May 18, 2024

@richmolj could you post the solution here?
I had to create my own strong_param for floats

from graphiti.

richmolj avatar richmolj commented on May 18, 2024

If you upgrade to the latest compliable, you should no longer get an error. The swagger type is :number and the payload type is Float.

from graphiti.

hector avatar hector commented on May 18, 2024

How does this work?
I thought default declarations for strong_params where here:
https://github.com/jsonapi-suite/strong_resources/blob/master/lib/strong_resources/configuration.rb

from graphiti.

richmolj avatar richmolj commented on May 18, 2024

Yes - the mapping to :number is here so attribute :numbermaps to Parameters.decimal. The payload bit is completely separate and is asserting on the rendered response as Float when running the generator.

from graphiti.

hector avatar hector commented on May 18, 2024

Thank you @richmolj
Just in case my case helps someone: I had to use ActionController::Parameters.float because ActionController::Parameters.decimal was not accepting a Ruby's float, I guess it needs a BigDecimal. I do not remember if the error was happening at the controller level or when saving the Active Record model.

from graphiti.

richmolj avatar richmolj commented on May 18, 2024

Yes, there is an improvement needed here to support both float and decimal. I have this on my list, but happy to merge if youd like to take a crack at a PR

from graphiti.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.