Giter Site home page Giter Site logo

Would a "required" spec be useful? about whip HOT 2 OPEN

tucotuco avatar tucotuco commented on September 23, 2024
Would a "required" spec be useful?

from whip.

Comments (2)

peterdesmet avatar peterdesmet commented on September 23, 2024

We had a required at one point, but you can replicate it with:

sex:

Or for multiple fields:

sex:
lifeStage:
recordedBy:

Listing a field in the specifications will trigger a test for that field. If that field cannot be found, than the implementation will throw an error.

However, empty: False is implied by default for any field (the field cannot be empty). So, if you rather just know if a field is available, without making any statements about its content, you should use:

sex:
  empty: True

Also note that the specifications dictate what will be tested in the data file, not the other way. So if a data file contains fields that are not listed in the specification, that this will not throw any warning or error.

from whip.

peterdesmet avatar peterdesmet commented on September 23, 2024

Oh, the required we had was also term1 : required, term2 : required not required: term1, term2 as you suggest. Anyway, I like the syntax as in my previous comment, because it does not break the term: specification pattern.

Also, it allows to start a specification quite gentle:

scientificName:
  empty: True

recordedBy:
  empty: True

(both terms above should be in the file)

And you can extend it easily to a more robust specification:

scientificName:
  allowed: [...]

recordedBy:
  delimitedvalues:
    delimiter: " | "
    regex: ...

from whip.

Related Issues (19)

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.