Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $schema to pact files #476

Open
mefellows opened this issue Nov 27, 2024 · 2 comments
Open

Add $schema to pact files #476

mefellows opened this issue Nov 27, 2024 · 2 comments
Labels
enhancement Indicates new feature requests

Comments

@mefellows
Copy link
Member

Adding the $schema keyword to JSON files provides additional support for the comprehension of pact files. For example, most IDEs will provide auto-completion and documentation. Adding a schema will help tool builders who wish to parse, manipulate or otherwise handle pact files in an unobtrusive way.

For each pact specification, we publish JSON Schemas to describe their shape (they could do with some additional human-readable descriptions).

Example:

Screenshot 2024-11-28 at 9 32 46 AM Screenshot 2024-11-28 at 9 33 16 AM

We may also wish to add $id, but I don't believe this is strictly necessary to get the benefit we're after.

@mefellows mefellows added the enhancement Indicates new feature requests label Nov 27, 2024
@rholshausen
Copy link
Contributor

Ok, I'm out, I quite. I'll leave it for you lot to mess up.

Seriously, the Pact file format is meant to be an intermediate format for machines, not for people to edit.

@mefellows
Copy link
Member Author

Adding a schema will help tool builders who wish to parse, manipulate or otherwise handle pact files in an unobtrusive way.

I'm not suggesting people edit it by hand. Having a $schema in the pact file itself will make it more obvious to tool builders that such a schema exists and that they can then use it to ensure they do it safely. The IDE support would be helpful in those situations to guide the developer. It also provides an avenue for other machine-only use cases, such as validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants