Giter VIP home page Giter VIP logo

Comments (10)

intZero avatar intZero commented on May 27, 2024 1

My bad! Have opened a PR here #870

from apispec.

lafrech avatar lafrech commented on May 27, 2024

Thanks for reporting. Would you like to work on this (change + test)?

from apispec.

intZero avatar intZero commented on May 27, 2024

Yeah I've made the change and written a couple of tests for it, should I open a PR against dev?

from apispec.

lafrech avatar lafrech commented on May 27, 2024

Yes, please !

from apispec.

intZero avatar intZero commented on May 27, 2024

Cool, could I get access to create branch intzero/fix-decimal-range please?

from apispec.

lafrech avatar lafrech commented on May 27, 2024

The procedure is to push the branch to your GH fork, then open the PR.

from apispec.

lafrech avatar lafrech commented on May 27, 2024

Sorry for not spotting this any sooner, but I think the way to go is to set as_string=True in Decimal field, rather than adding field-specific code in a generic function.

See

from apispec.

intZero avatar intZero commented on May 27, 2024

Yeah I saw your reply to the PR. I really don't think that asking people to change their business logic by changing the serializer to use a different variable type is a solution imho! Secondly, it isn't a solution anyway as you will end up with:

type: number
  minimum: '0'
  maximum: '1000000'

This range is processed by OpenAPI as a string and thus doesn't correctly display the range for this field since it is a number. The other problem you're going to have is when outputting yaml with Decimals. Seeing as pyyaml (the library that your to_yaml() function uses and seems to be the only viable yaml library for python) doesn't support them (which is why this issue is similar to the one you linked with the json library). There are a number of issues like this yaml/pyyaml#255 which have been open for years with no reply or merge so it doesn't look like it'll get fixed anytime soon either. Sometimes to fix a problem you need to make pragmatic concessions.

No problem - it's starting to look as though the solution is me writing a work-around in my doc build tools to specifically deal with Decimals. I can close my PR.

from apispec.

lafrech avatar lafrech commented on May 27, 2024

from apispec.

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.