GithubHelp home page GithubHelp logo

salesforce / avocat Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 7.0 1.19 MB

๐Ÿฅ‘ Continuous contract testing tool for HTTP APIs

License: BSD 3-Clause "New" or "Revised" License

JavaScript 5.25% TypeScript 94.75%

avocat's People

Contributors

arosenbach avatar lionelarmanet avatar raminoufal avatar svc-scm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avocat's Issues

Handling POST HttpMethod

We're currently dealing only with the get method for the sake of simplicity, but all other HttpMethods should be considered when:

  • parsing (parse the requestBody)
  • sending a request
  • handling a variant

Handle the case when an OpenAPI contract has no title field

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>

Refactoring, validator-service and contract-repository

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.

The `core` layer should not depend on the `infrastructure` layer

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.

Use DomainEvents instead of EventEmitter for logging

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.