GithubHelp home page GithubHelp logo

opman129 / docs-openapi-specs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alchemyplatform/docs-openapi-specs

0.0 0.0 0.0 8.01 MB

OpenAPI Specs for methods on docs

JavaScript 94.80% Shell 5.20%

docs-openapi-specs's Introduction

Alchemy Docs

Hey there - thanks for checking our API docs! ๐Ÿ‘‹

This repo holds the OpenAPI specs that power our API Playgrounds at docs.alchemy.com/reference ("Try it" sections on the right).

Getting started

  1. Clone the repo.
git clone https://github.com/alchemyplatform/docs-openapi-specs
  1. Install dev dependencies.
npm i

Frens

Feedback? Issues? Typos?

We are continuously trying to improve our docs - any help is very welcomed! ๐Ÿ˜€

You can:

If you're feeling adventurous, feel free to open a pull request here.

You currently can only modify API playgrounds. For pages or markdown edits in API Reference, please use one of the above options.

WIP ๐Ÿ‘ทโ€โ™€๏ธ

Below section is WIP. Until we add ids to every spec, deploy specs as you normally would.

Alchemists ๐Ÿ‘ฉโ€๐Ÿ”ฌ

To speed up your development, 2 commands are now available.

  • npm run create spec.yaml
  • npm run update spec.yaml

You no longer need to run the rdme command line directly to push to staging. You also no longer need to pass an API key and readme id! ๐ŸŽ‰

First time?

Make sure you first ran through the steps above.

  1. Clone .env.template into .env.
cp .env.template .env
  1. Grab Readme API key.

  2. Update RDME_API_KEY in .env.

Creating new spec

Known issue: will remove comments and format spec when run.

  1. Write your spec (e.g. newspec.yaml).

  2. Run create script passing the path to your spec.

  npm run create transact/newspec.yaml

This will:

  • deploy your spec to readme
  • create a page and id
  • associate page id with your spec
  1. Your spec will be updated with a x-readme.id field. This is super important to ensure updates work smoothly in the future!

Updating spec

Run update script. Ensure x-readme.id is set.

npm run update spec.yml

Troubleshooting

  1. Check RDME_API_KEY is set in .env.
  2. Check you provided a valid path to a .yaml file when running the scripts.
npm run create spec.yaml
npm run update spec.yaml
  1. Check the spec has a x-readme.id property. This id is used to match the spec on Readme's side.
  2. Reach out to Bastien if you have any issues running the scripts.

Linting

Linting is ran automatically when using npm run create and npm run update (powered by Spectral).

You can run it manually using

npx spectral lint spec.yaml

Rules we currently adhere - here.

You should also install the extension for your editor.

Quirks

We currently cannot use oas-normalize to resolve $refs in specs.

It relies on @readme/openapi-parser which relies on @readme/json-schema-ref-parser.

@readme/json-schema-ref-parser is a fork of @apidevtools/json-schema-ref-parser.

This is a known issue of json-schema-ref-parser - see here.

Until the issue gets resolved and changes get merged upstream, solution is to dereference the spec using @openapi-generator-plus/json-schema-ref-parser(https://www.npmjs.com/package/@openapi-generator-plus/json-schema-ref-parser).

This also means validation is done prior to running scripts via Spectral rather than with oas-normalize.

Future improvements

  • Refactoring (OAS Components / Schemas, break up nfts.yaml, sdk.yaml).
  • More linting rules
  • update multiple specs at once
  • create and update scripts share a lot of code (can be simplified)
  • create script remove comments

Resources

docs-openapi-specs's People

Contributors

sahilaujla avatar elanh avatar elan-halpern avatar aliraza1231 avatar ayang-rkjs avatar ankg avatar pileofscraps avatar alex-miao avatar opman129 avatar deric-alchemy avatar h1teshtr1path1 avatar tchowd avatar bmoyroud avatar joshzhang5 avatar brg8 avatar thebrianchen avatar chris-moller avatar mintymento456 avatar dependabot[bot] avatar ddxgod avatar avarobinson avatar niveda-krish avatar stavares843 avatar shreyas-v-agnihotri avatar oceans404 avatar omahs 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.