salesforce / avocat Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Continuous contract testing tool for HTTP APIs
License: BSD 3-Clause "New" or "Revised" License
๐ฅ Continuous contract testing tool for HTTP APIs
License: BSD 3-Clause "New" or "Revised" License
We're currently dealing only with the get method for the sake of simplicity, but all other HttpMethods should be considered when:
Contract naming depends basically on the title field in the imported swagger contract. Thus, every contract should have a unique title, otherwise, there should be a validation error displayed to the user.
Another option is to ask the user to enter a contract name as an argument of the import command. $ avocat import <contract_path> --name <contract_name>
The validatorService.validateContract*()
methods should be merged into one method in the test command class test-command.ts
. The service validator-service.ts
has the responsibility to call the proper repository method depending on the input params (URL, name, and version).
In addition, it is the contract repository job to load the contract's content, not the service, loadContracts in validator-service.ts
should be embedded in the repository findBy*
methods.
When validating an API, the values of the parameters sent in the request come from the example/examples objects. These objects are not required in the OpenAPI schema.
Proposal: Generate values for parameters using Faker.js when no examples found.
The special characters in the swagger contract title ('/', '', ' ', ...) should be handled and replaced by characters that are valid to be in a file path.
For now, only required query parameters are sent in the request. Path parameters should be handled as well and added to the request
Currently, the core layer depends on the infrastructure layer because of the way the dependencies are injected:
$ find src/main/core -name '*.ts' | xargs grep import | grep -e 'infrastructure/\|app/'
src/main/core/validator/impl/validator-service-impl.ts:import {FileStoreContractRepository} from '../../../infrastructure/repository/file-store-contract-repository';
src/main/core/validator/impl/validator-service-impl.ts:import {AxiosHttpClient} from '../../../infrastructure/http/axios/axios-http-client';
src/main/core/validator/impl/validator-service-impl.ts:import {AjvContractValidator} from '../../../infrastructure/validator/ajv/ajv-contract-validator';
src/main/core/status/status-service.ts:import {FileStoreContractRepository} from '../../infrastructure/repository/file-store-contract-repository';
src/main/core/import/import-service.ts:import {FileStoreContractRepository} from '../../infrastructure/repository/file-store-contract-repository';
We may wanna find a better way to inject the core dependencies. We may also enforce the dependency check with a script that could throw an error if find src/main/core -name '*.ts' | xargs grep import | grep -e 'infrastructure/\|app/'
returns results.
Currently, only JSON response schema is dealt with, but other formats such as XML or text/plain or HTML,... should be taken into account as well.
We're using at the moment the NodeJS built-in Event Emitter to decouple the technology we're using for logging from the production code. So that it could be modified easily.
An enhancement would be to use DDD DomainEvents to make logging events even more generic.
There should be a way to import all contacts in a directory instead of importing them one by one.
Proposal: $ avocat import contracts/*
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.