Get Pact community to validate v1 Schema

Issue #4 closed
Ben Sayers created an issue

List of questions/assumptions:

  • interaction.response.body: What types are allowed here? Right now I've allowed any value.
  • interaction.description: Is this a required property? Right now I've made it required.
  • createdAt: Is this part of the Pact schema? Or does the Pact Broker add it?
  • metadata: Is this a required property? Right now I've made it required.
  • metadata.pactSpecificationVersion: Is this a required property? Right now I've made it required.
  • metadata.pact-specification.version: The Pact JVM implementation writes the version in a different place to the Ruby implementation. Are both allowed? Are all consumers of this value expected to support both variations?
  • provider: Is this a required property? Right now I've made it required.
  • consumer: Is this a required property? Right now I've made it required.
  • interaction.request.query: Is the query string format required (name1=value1&name2=value2)? How strict should the schema be about this? Right now I've written a regex to enforce this format, it may be too strict. I can see one of the pact specification tests allows erroneous "=" characters in values.
  • interaction.provider_state: Which versions of Pact use provider_state compared to providerState? I notice Pact JVM generates pact 2.0 files with providerState and Ruby generates pact 2.0 files with provider_state. Do all implementations support both names?
  • interaction.request: Are additional properties allowed on this object? Right now I've made is disallowed.
  • interaction.response: Are additional properties allowed on this object? Right now I've made is disallowed.
  • interaction.response.headers: Are the values of headers required to be strings? Right now I've made strings required.

Comments (5)

  1. Ronald Holshausen

    Here are some answers:

    • interaction.response.body: Can be any value.
    • interaction.description: Is this a required property? Yes
    • createdAt: Is this part of the Pact schema? Or does the Pact Broker add it? - Added by pact broker
    • metadata: Is this a required property? Right now I've made it required. - Optional
    • metadata.pactSpecificationVersion: Is this a required property? Right now I've made it required. - Optional
    • metadata.pact-specification.version: The Pact JVM implementation writes the version in a different place to the Ruby implementation. Are both allowed? Are all consumers of this value expected to support both variations? - Format should follow JSON conventions, which is camel-case. But we need to support both
    • provider: Is this a required property? Right now I've made it required. - Required
    • consumer: Is this a required property? Right now I've made it required. - Required
    • interaction.request.query: Is the query string format required (name1=value1&name2=value2)? How strict should the schema be about this? Right now I've written a regex to enforce this format, it may be too strict. I can see one of the pact specification tests allows erroneous "=" characters in values. - We should be strict, but the later spec versions store these as maps, so there might not be much value in spending a lot of effort on this
    • interaction.provider_state: Which versions of Pact use provider_state compared to providerState? I notice Pact JVM generates pact 2.0 files with providerState and Ruby generates pact 2.0 files with provider_state. Do all implementations support both names? - Format should follow JSON conventions, which is camel-case. But we should support both for backwards compatibility.
    • interaction.request: Are additional properties allowed on this object? Right now I've made is disallowed. - No optional properties
    • interaction.response: Are additional properties allowed on this object? Right now I've made is disallowed. - No optional properties
    • interaction.response.headers: Are the values of headers required to be strings? Right now I've made strings required. - Header values are parsed as text, so they should be strings
  2. Ben Sayers reporter

    Nice, thanks for that @ron_holshausen. I'll update the v1 schema based on your feedback and create schemas for v2 and v3 when I get a chance.

  3. Log in to comment