Comments (8)
Isn't this the counterpart of the PactSpecification
enum defined in pact.h
?
/**
* Enum defining the pact specification versions supported by the library
*/
typedef enum PactSpecification {
/**
* Unknown or unsupported specification version
*/
PactSpecification_Unknown,
/**
* First version of the pact specification
*/
PactSpecification_V1,
/**
* Second version of the pact specification
*/
PactSpecification_V1_1,
/**
* Version two of the pact specification
*/
PactSpecification_V2,
/**
* Version three of the pact specification
*/
PactSpecification_V3,
/**
* Version four of the pact specification
*/
PactSpecification_V4,
} PactSpecification;
In which case V4
does correctly correspond to int 5
.
from pact-js.
No, the issue is that PactV3Options has
/**
* Specification version to use
*/
spec?: SpecificationVersion;
https://github.com/pact-foundation/pact-js/blob/master/src/v3/types.ts#L102
If you try use that enum value SPECIFICATION_VERSION_V4 , you get that error.
from pact-js.
It seems correct to me to use spec?: SpecificationVersion
with an enum. I'm guessing then that the num is incorrectly handled elsewhere and is converted to an integer in a somewhat naive way? Or perhaps some confusion between ints and enum values in:
Lines 3 to 21 in 59081f2
from pact-js.
Can you please show the MessageConsumerPact
constructor you used (i.e. the setup code)?
from pact-js.
I can see the problem, I think. The type MessageConsumerOptions
does not take the enum, it takes an integer (it predates the later interfaces which accept the enum because that would have broken the backwards-compatibility of the API): https://github.com/pact-foundation/pact-js/blob/master/src/dsl/options.ts#L104
It accepts an integer that maps logically to each version (1
= spec version 1, 2
= spec version 2 etc.). When you pass in the enum, the value is mapped to the core (as Josh has noted). Due to the zero indexing and the support for 1.1, Spec Version 4 maps to the integer 5
.
In any case, it's an unfortunate inconsistency in the interface. There is not yet a V4 version of Asynchronous Messages that aligns with the most recent DSL.
TL;DR - use 4
instead of the enum.
No, the issue is that PactV3Options has...
Where are you getting that type for? That's only used in the PactV3
type, not the messaging type.
from pact-js.
Ah, you are correct.
// Specification Version (should be 3 for messages)
spec?: number;
This is confusing. Also not having V4 support for asynchronous messages.
from pact-js.
Yeah, I have an open branch with partial support for the updated asynchronous interface (this was the original one that supported the Ruby messaging API, and doesn't support plugins etc.).
I'll update the comment for now.
from pact-js.
I'll close this and open a feature request for Async Messages
from pact-js.
Related Issues (20)
- High Prototype Pollution risk caused by lodash.omitby/4.6.0 scanned by BlackDuck for @pact-foundation/pact@^12.1.2 HOT 3
- Improve developer experience around consumer pact testing HOT 2
- RFC: Remove CLI & Standalone API (Pact Standalone Tools - Ruby), and migrate into sister package pact-js-cli enhancement
- RFC: Support Alpine
- RFC: Pact JS V9.x - Update to latest V2 standalone / Include ARM64 Platforms HOT 1
- V4 Asynchronous Messages
- Bug: Corporate Proxy not supported during verification
- TypeError: ffi.pactffiMessageGivenWithParams is not a function HOT 2
- Support combining matching rules HOT 1
- `eachLike` behaves like `atLeastOneLike` when min is not explicitly set - contrary to documentation HOT 5
- payload changed by pact between consumer test and provider test HOT 6
- Message provider verification error: "Caught panic with error: failed printing to stdout" HOT 8
- CVE check denying [email protected] which is dependent on by pact-foundation/pact HOT 3
- V3 Matchers package missing matchers from V2
- BadSignature error when approaching broker on HTTPS HOT 5
- Vitest - Pact Verifier fails with 3 or more interactions HOT 8
- V4InteractionWithCompleteRequest is unimplemented HOT 9
- Allow using `new ArrayBuffer(0)` in withRequest.body to be honest in the contract tests HOT 1
- MatchersV3.reify doesn't extract payload from MatchersV3.nullValue() HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-js.