Coder Social home page Coder Social logo

Comments (3)

mefellows avatar mefellows commented on May 29, 2024

With current matchers it's possible to say that if a property exists it has to be of a special type or must have a special content, but it's not possible to assure, that the property has to exist at all

This is incorrect. The problem is, the matcher you've identified is too broad and is not being specific about what it needs. A matcher such as the following would satisfy your request:

"$.body.abc": 
{
"match": "type"
}

How did you arrive at the above matching rule?

from pact-specification.

Sinuhe20 avatar Sinuhe20 commented on May 29, 2024

Is not working for me, if "abc" is missing, test is also ok with this rule.

There is also a problem with arrays, let's say you have the matcher

"$.body.array": 
{
  "min": 1,
  "match": "type"
}

It works perfect, as long as 'array' is present in the body. But if property 'array' is missing, test says also everything is ok.

I think there is the general problem, that if no matcher can be selected, the test will pass.

P.S.

I see if I omit

"$.body.*": 
{
  "match": "type"
}

the matching is more strict, but than I have to define type rules for every attribute. This could work but is very inconvenient.

from pact-specification.

mefellows avatar mefellows commented on May 29, 2024

from pact-specification.

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.