You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
Continuing to think about new APIs that align with the Roadmap, here's how I think generation could be improved Roadmap.
The big advantage of current generation features is the ability to provide more generation hints. Giving a hint (via the service_manifest) for the URI template is especially useful, because it saves cleaning up the file names, URI templates, and de-duplicating contracts after generation.
This also provides some hints of what a Provider API may look like.
Pacto.configuration.generation_hintsdo |hints|
hints.generation_enabled=truehints.schema_version=:draft4hints.overwrite=falsehints.save_examples=truehints.generate_defaults=falseendPacto.provider(:my_api)doservice_manifestdo# You can load existing services as-is:load_services'contract/my_api/**/*.json'# However, providing an brief description of each service can provide useful generation hints# This isn't a full service contract - it's more like an index or table of contents...# but the info here can be useful hints for generation or reporting.service'List Projects',:get,'https://example.com/projects',file: 'contracts/list_projects.json'# This provides useful hints that we couldn't get from the HTTP interaction itself, like:# - A nickname for the service# - The URI template, which tells us about the id and sort variables (and prevents us from generating duplicate contracts)# - A preferred location to store the contract, because the default would have been something like# contracts/my_api/example.com/projects/{id}/put_{id}.json.# - Note: the nickname alone might be enough to have better default locations, assuming names are unique# at least within a provider.service'Create or Update Project',:put,'https://example.com/projects/{id}{?sort}',file: 'contracts/put_project.json'service'Get Project',:get,'https://example.com/projects/{id}',file: 'contracts/get_project.json'end# A manifest could probably be loaded via JSON or YAML rather than a block.service_manifest('providers/my_api/manifest.yaml')end# Execute tests as normal (by running real consumers or simulated consumers) in order to generate
The text was updated successfully, but these errors were encountered:
Continuing to think about new APIs that align with the Roadmap, here's how I think generation could be improved Roadmap.
The big advantage of current generation features is the ability to provide more generation hints. Giving a hint (via the service_manifest) for the URI template is especially useful, because it saves cleaning up the file names, URI templates, and de-duplicating contracts after generation.
This also provides some hints of what a Provider API may look like.
The text was updated successfully, but these errors were encountered: