GithubHelp home page GithubHelp logo

trim's Introduction

TRIM - A java library to assess API endpoint field-level usage

Features

  • Bulk GET requests to API endpoints that deliver JSON
  • Progress update every time a request to an endpoint completes
  • Report request time
  • Report request size
  • Report status code of requests
    • Deliver result if status code is 4xx
  • Report which attributes are used and which aren’t
  • Report when attributes were stopped being used
  • Report type mismatch between endpoint response fields and model fields

Importing through maven

Coming soon.

Usage

Trim works on top of annotated model classes. The list of available annotations is the following:

  • @Endpoint: associates an endpoint to a model class. Takes a String as the argument
  • @Header: contains information about a header specific to the request for the endpoint associated with a particular model. Takes two strings indexed as header and value
  • @Headers: specifies multiple headers to be associated to a request. Takes an array of @Headers as the argument
  • @Skip: marks a model attribute as irrelevant.
  • @AttributeName: specifies the name of the endpoint attribute associated to a model attribute if their names mismatch
  • @CollectionGenericType: for types that extend collection, the generic type of the collection needs to be specified. This is because due to type erasure the generic type ain't available at runtime. Takes a Class as the argument
  • @UnusedSinceVersion specifies the version in which an attribute was left unused in the model. Takes an int as the argument

To start the analysis, you need to set up an instance of Specification. There are three methods in the Specification class to achieve this goal:

  • Specification.setCurrentApplicationVersion(int) -> lets trim know which is the current version of the application
  • Specification.addModel(Class<?>) -> registers a model for analysis
  • Specification.addHeader(String, String) -> specifies a header that will be applied to all requests

Once the Specification is set up, pass it to Trim.run(Specification) or Trim.run(Specification, ProgressListener) if you want progress updates when endpoint analyses complete.

For more details check out the sample module.

trim's People

Contributors

izzyalonso avatar

Stargazers

Brad Montgomery avatar

Watchers

James Cloos avatar

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.