pact-specification icon indicating copy to clipboard operation
pact-specification copied to clipboard

Change provider_state to providerState

Open bethesque opened this issue 10 years ago • 15 comments

Underscores are ruby specific, JSON is traditionally camel case.

bethesque avatar Jul 22 '14 06:07 bethesque

I'm writing some code that parses pact files, I can't see anywhere in the specification tests where provider state is defined. Should it be providerState or provider_state? And has this changed between pact specification versions?

BenSayers avatar Jan 17 '17 02:01 BenSayers

The original Ruby version used provider_state, but that was changed very early on because JSON in general uses camel case. But more to your point, there is no formal example or schema in the specification project for a Pact file.

uglyog avatar Jan 17 '17 03:01 uglyog

If you would accept a JSON Schema file for Pact I'd be happy to contribute it. I'd just need some guidance on where it should live and how we can test it's correctness. Maybe each of the pact fragments in this specification project could be validated by the schema?

BenSayers avatar Jan 17 '17 04:01 BenSayers

More than happy to accept a Schema file. You can create it in the root of the project for the appropriate branch, and we need to also create an example test pact file for it. The test cases are not full pact files, so we can't use those.

uglyog avatar Jan 17 '17 05:01 uglyog

Just to tag on a note from the google group where we've just had the same discussion :-)

Another way to go might be a linter / validator for implementation developers to use to ensure they'e conforming to agreed standards. I would have thought this would be fairly straight forward to set up given that we must read and validate Pact files already? The catch might be having the ability to specify which Pact version to validate against and providing version specific errors...

Just a thought.

davesmith00000 avatar Jan 20 '17 11:01 davesmith00000

@davesmith00000 That is a good idea, it won't be hard to take the existing Pact reading code out of one of the implementations and create a verifier tool.

uglyog avatar Jan 21 '17 05:01 uglyog

The Rust work you've done @uglyog seems like a good candidate :)

mefellows avatar Jan 21 '17 09:01 mefellows

I've made a start on creating the JSON Schemas and have a close to complete schema for Pact v1.0.0. I put it in a seperate project as I wanted to write automated tests to verify the schema is correct, but if you want to move it somewhere else I don't mind.

https://bitbucket.org/atlassian/pact-json-schema/overview https://www.npmjs.com/package/pact-json-schema

Who is the best person to work with to check my assumptions?

BenSayers avatar Mar 10 '17 04:03 BenSayers

I created a list of assumptions/questions I have here:

https://bitbucket.org/atlassian/pact-json-schema/issues/4/get-pact-community-to-validate-v1-schema

BenSayers avatar Mar 10 '17 06:03 BenSayers

I get an Error "Access Denied" page trying to get to that issue, but I can browse the source.

In any case @uglyog and @bethesque are probably the best people to review this.

mefellows avatar Mar 11 '17 04:03 mefellows

Sorry @mefellows I screwed up the permissions. Should be fixed now.

BenSayers avatar Mar 11 '17 06:03 BenSayers

@uglyog @bethesque feel free to throw inline comments here, which you should have permission to do after logging in:

https://bitbucket.org/atlassian/pact-json-schema/commits/a07b4776913aec3d1eb146f78c14e72361aee4ec?at=master#chg-schemas/v1.0.0/schema.json

BenSayers avatar Mar 13 '17 01:03 BenSayers

In https://bitbucket.org/atlassian/pact-json-schema/src/529795b6fc02df10b7a24f4390aa9fb9476473e8/schemas/v1/schema.json?at=master&fileviewer=file-view-default there is no mention of providerState. Only the very earliest pacts (mostly in REA) used provider_state, so I think it should be providerState.

bethesque avatar Mar 13 '17 22:03 bethesque

What about consumer name and provider name?

bethesque avatar Mar 13 '17 22:03 bethesque

Just a semantic issue, I'd say "There is one schema for each Pact specification version", because we don't want to confuse it with the concept of "pact instance versions".

bethesque avatar Mar 13 '17 22:03 bethesque

Believe this is done

v2 uses providerState, v3 uses providerStates https://github.com/pact-foundation/pact-specification/tree/version-3?tab=readme-ov-file#allow-multiple-provider-states-with-parameters

YOU54F avatar Jun 26 '24 00:06 YOU54F