Coder Social home page Coder Social logo

taxonworks_api's Introduction

docs

taxonworks_api

Documentation for the TaxonWorks workbench API, served at https://api.taxonworks.org. Application code is here.

Building

Documentation uses RAML, it is built with gulp:

Clone this repository, then:

npm install

npx gulp apidoc

Documentation is in /docs. Open /docs/index.html to view locally, or see running an api console.

Deploying

Merge development into main. Github actions do the rest.

Changelog

See CHANGELOG.md. Note this changelog documents changes in the documentation, not the underlying code.

Contributing

See CONTRIBUTING.md.

License

https://opensource.org/licenses/NCSA.

Code of conduct

Please see CODE_OF_CONDUCT.md.

taxonworks_api's People

Contributors

ankitgohel1996 avatar dependabot[bot] avatar devarshar avatar jlpereira avatar jrflood avatar locodelassembly avatar mjy avatar sebsebmc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taxonworks_api's Issues

configure CI generation

Most of the workflow seems to be doable via this pattern

  • setup our TW Bot to provide the personal access token

  • figure out how to encrypt and supply that token to Travis

  • setup hook to Travis that is fired for only a specific type/class of commits (see infinite loop) (i.e. only when a .raml file changes should we trigger Travis)

  • setup a local build script to generate the HTML from RAML (#10)

  • integrate that build script into .travis.yml

  • ensure that when Travis commits /doc back to this repo

  • ... profit

Add OpenAPI and Insomnia config?

I used oasraml-cli to convert the TaxonWorks api.raml to OpenAPI 3.0, which can be imported into the Insomnia client. This might be useful to provide to users, because it makes exploring the API easier. I've attached these files here.

Under manage environments, the following variables need to be configured within the Insomnia project environment:

image

{
  "user_token": "",
  "project_token": "",
  "project_id": "",
  "base_path": "/api/v1",
  "host": "sandpaper.taxonworks.org",
  "scheme": "https",
  "taxon_id": ""
}

define a basic response pattern

  • differentiate b/w HTTP errors and application errors
  • differentiate b/w data elements and response metadata
  • differentiate b/w RESTful and non-restful endpoints (yes there will be both)
  • determine if any elements belong in header vs. body

Auto-generate HTML docs from RAML

  • setup a structure for housing the input RAML files (check out how others are setting this up)
  • setup a structure for housing the build scripts (/build ?)
  • build the conversion script (node/webpack? grunt/gulp? - maybe help from José)
  • ensure the build script has proper success/failure responses that can be interpretted and used by the travis environment
  • Demonstrate local build server (analagous to jekyll server) that listens to raml file changes and does local builds

Some gulp tasks error

OS X latest. Started with npm install. If we don't need these tasks let's just destroy them.

  • gulp apijson fails
  • gulp apiyaml fails

Preceeding both with npx also fails.

Alphabetize params list

For each endpoint let's go ahead and set the standard to be an alphabetized list of params.

consider auto-generating components of the base API file

We have demonstrated generating routes based on model properties, it's worked very nicely for our annotations layer. We could follow this pattern, perhaps in a Rake task, to generate the components of the API that are included in the description.

Example route generating code. This loops all data models, checking to see whether they inherit from an annotating class, and adding RESTFUL getters if so. The code could be modified to produce type lists in RAML, for example.

  # Generate shallow routes for annotations based on model properties, like
  # otu_citations GET    /otus/:otu_id/citations(.:format)    citations#index
  ApplicationEnumeration.data_models.each do |m|
    Shared::IsData::Annotation::ANNOTATION_TYPES.each do |t|
      if m.send("has_#{t.to_s}?")
        n = m.model_name
        match "/#{n.route_key}/:#{n.param_key}_id/#{t}", to: "#{t}#index", as: "#{n.singular}_#{t}", via: :get, constraints: {format: :json}, defaults: {format: :json}
      end
    end 
end

Work up CONTRIBUTING.md

  • It should describe the format of PR
  • It should describe the pattern for accepting the PR

etc.

Boolean vs. String params

Using type: Boolean forces the enum to true or false (true booleans). Technically our back end handles strings, converting them to true or false there. We also handle Capitalized and upcase values as well.

Should we just declare our booleans to be string, so we can provide examples as enums?

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.