Git Product home page Git Product logo

Comments (4)

tomlarkworthy avatar tomlarkworthy commented on May 23, 2024

Hi Thorben, your constraint is correct. The inline testing doesn't cover
arbitrary rules in the "constraint" field, as some of those constraints
depend on previous data and there is no way of currently specifying that.

That said, numeric ranges are such a common constraint I think they deserve
to be expressed in the schema language and tested inline as well. So I will
implement this post haste, but for now your system works but the inline
testing framework is not powerful enough to detect it (there is an open
issue on making that more powerful as well).

Tom

On Thu, Aug 28, 2014 at 8:58 AM, Thorben Schrรถder [email protected]
wrote:

Hey, is there no way to define numerical constraints (e.g.: must be
between 1 and 999)? I've tried this minimal rule set but blaze tells me my
0 nonexample passes :/

schema:
definitions:
price:
type: number
constraint: next > 0 && next < 100000 # between 0
examples:
- 1
- 1000
- 99900
nonexamples:
- 0
- 100000
- 1000000

type: object
properties:
prices:
type: object
$priceId: {$ref: "#/definitions/price"}

Is that just not possible at all?

Thanks!

Thorben

โ€”
Reply to this email directly or view it on GitHub
#13.

from blaze_compiler.

walski avatar walski commented on May 23, 2024

Hey, thanks for the quick clarification. I'll just comment the examples out for now. And btw, keep up your amazing work. I've last edited Firebase security rules about a year ago and Blaze is sooooooo good! Thanks ๐Ÿ‘

from blaze_compiler.

tomlarkworthy avatar tomlarkworthy commented on May 23, 2024

ok you can set ranges now (with testing), explained here: https://github.com/firebase/blaze_compiler#ranges

from blaze_compiler.

walski avatar walski commented on May 23, 2024

Works like a charm!

from blaze_compiler.

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.