Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Future Dredd proposal #1186

Description

@honzajavorek

Dredd reads the API description document, executes HTTP requests it finds, and validates the HTTP responses it receives.

  • “Designing your API prior to its implementation makes it human-friendly”
  • “Dredd enables you to design your API prior to its implementation”

I think Dredd's architecture should get more modular, decoupled. This is my idea on how it should look like:

Direction

  • Be active player in OAS3 adoption, make it a first-class citizen, use OAS3 examples in the docs with a priority over OAS2 examples
  • As Dredd gets decoupled, it should have multiple commands - dredd server for testing server, dredd client for testing clients (aka client-testing mock server: see this), dredd traffic for testing arbitrary previously recorded traffic
  • Explore the ability to test whole scenarios (comes with testing arbitrary recorded traffic)
  • Explore the ability to use FaaS for hooks

Support

  • Write a blog post about how to use Dredd - Apiary blog, dev.to, docs (tutorial), ...
  • Talk about Dredd at meetups and conferences
  • Get a new set of stickers printed and give them away at meetups and conferences
  • Monitor Twitter for new articles and mentions, actively RT and reply - TweetDeck search is (dredd api) OR (dredd openapi) OR (dredd oas)

Architecture

  • API description parsing is a separate library (done as dredd-transactions/parse), the input interface for the Dredd core is API Elements
  • There is a separate library to turn API Elements into an internal sequence of expected transactions (done as dredd-transactions/compile)
  • There is Dredd core, which takes a sequence of expected transactions (Test and document the possibility to modify the transactions list #995), performs the HTTP requests, and returns a sequence of real transactions, streamed
  • There is Dredd CLI, which takes care of the command-line interface and provides API Elements together with configuration
  • Dredd Hooks are a separate engine, which can transparently execute arbitrary code in JavaScript, other language, or delegate execution to FaaS
  • All hooks are provided with the real transaction(s) to modify, with the expected transaction(s) to inspect (Add description field to transaction object #1145), and with configuration (Access Custom options in Hooks #215)
  • Transaction names are completely agnostic to the API description format and work as a query language rather than paths or pointers
  • There is a validation engine, which gets a stream of expected/real transactions and is able to validate them either as units (one-by-one) or as a whole sequence
  • There is one good verbose reporter, one good minimal reporter, and TAP
  • Dredd is able to export the sequence of real transactions, e.g. to .har
  • The HTML reporter should render the same locally as the Apiary reporter and apiary.io should share the same (React) components for this

IMG_3495

IMG_3494

Gardening

  • Dredd is a monorepo, containing dredd as multiple separate libraries, then dredd-transactions, gavel-spec, and gavel.js. Later we could add other repositories as well, some good candidates would be dredd-hooks-template or dredd-docker.
  • Dredd is tested on CircleCI for speed and usability, together with AppVeyor for verifying Windows compatibility.
  • Re-evaluate the usefulness of test coverage and perhaps remove it altogether
  • e2e and possibly also integration tests are in Cucumber, with the use cases and design decisions clearly described in plain text (status: Cucumber introduced, but majority of e2e tests are not rewritten into it)
  • use Prettier to make the decaffeinate-formatted codebase readable
  • describe API in TypeScript annotations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions