├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── stale.yml └── workflows │ └── lint.yml ├── .gitignore ├── .node-version ├── .releaserc ├── BUILDING.md ├── CONTRIBUTING.md ├── CONVENTIONAL_COMMITS.md ├── Jenkinsfile ├── LICENSE ├── LICENSE.md ├── README.md ├── RELEASING.md ├── TESTING.md ├── VERSIONING.md ├── jest.config.js ├── package-lock.json ├── package.json ├── service-descriptions ├── api-with-examples-openrpc.json ├── empty-openrpc.json ├── link-example-openrpc.json ├── metrics-openrpc.json ├── params-by-name-petstore-openrpc.json ├── petstore-expanded-openrpc.json ├── petstore-openrpc.json └── simple-math-openrpc.json ├── src ├── index.test.ts └── index.ts ├── tsconfig.json └── tsfmt.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | aliases: 4 | # ------------------------- 5 | # ALIASES: Caches 6 | # ------------------------- 7 | - &restore-deps-cache 8 | key: deps-cache-{{ checksum "package.json" }} 9 | 10 | - &save-deps-cache 11 | key: deps-cache-{{ checksum "package.json" }} 12 | paths: 13 | - ~/examples/node_modules 14 | 15 | # ------------------------- 16 | # ALIASES: Branch Filters 17 | # ------------------------- 18 | - &filter-only-master 19 | branches: 20 | only: master 21 | - &filter-only-semantic-pr 22 | branches: 23 | only: /^(pull|dependabot|fix|feat)\/.*$/ 24 | 25 | defaults: &defaults 26 | working_directory: ~/examples 27 | docker: 28 | - image: cimg/node:20.12.1 29 | 30 | jobs: 31 | test: 32 | <<: *defaults 33 | steps: 34 | - checkout 35 | - restore_cache: *restore-deps-cache 36 | - run: npm install 37 | - run: npm install codecov 38 | - run: npm test 39 | - run: ./node_modules/.bin/codecov 40 | - save_cache: *save-deps-cache 41 | 42 | build: 43 | <<: *defaults 44 | steps: 45 | - checkout 46 | - restore_cache: *restore-deps-cache 47 | - run: npm install 48 | - run: npm run build 49 | - save_cache: *save-deps-cache 50 | 51 | release: 52 | <<: *defaults 53 | steps: 54 | - checkout 55 | - restore_cache: *restore-deps-cache 56 | - run: npm install 57 | - run: npm run build 58 | - run: npx semantic-release 59 | - save_cache: *save-deps-cache 60 | 61 | workflows: 62 | version: 2 63 | analysis: 64 | jobs: 65 | - test: 66 | filters: *filter-only-semantic-pr 67 | - build: 68 | filters: *filter-only-semantic-pr 69 | 70 | release: 71 | jobs: 72 | - test: 73 | filters: *filter-only-master 74 | - build: 75 | filters: *filter-only-master 76 | - hold: 77 | filters: *filter-only-master 78 | type: approval 79 | requires: 80 | - test 81 | - build 82 | - release: 83 | filters: *filter-only-master 84 | context: open-rpc-deployer 85 | requires: 86 | - hold 87 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | indent_style = space 9 | indent_size = 2 10 | tab_width = 2 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@typescript-eslint/parser', 4 | plugins: [ 5 | '@typescript-eslint', 6 | ], 7 | extends: [ 8 | 'eslint:recommended', 9 | 'plugin:@typescript-eslint/eslint-recommended', 10 | 'plugin:@typescript-eslint/recommended', 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: stale 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | 4 | jobs: 5 | lint: 6 | name: lint 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v1 10 | - name: Use Node.js 14.15.1 11 | uses: actions/setup-node@v1 12 | with: 13 | node-version: 14.15.1 14 | - name: npm install 15 | run: npm install 16 | - name: lint 17 | run: npm run lint 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | /**/build 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 20.12.1 2 | -------------------------------------------------------------------------------- /.releaserc: -------------------------------------------------------------------------------- 1 | { 2 | "tagFormat": "${version}" 3 | } 4 | -------------------------------------------------------------------------------- /BUILDING.md: -------------------------------------------------------------------------------- 1 | # Building 2 | 3 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. 4 | 5 | This document is licensed under [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). 6 | 7 | When using the name 'version' we mean the versioning scheme described in [VERSIONING.md](VERSIONING.md) 8 | 9 | ## Introduction 10 | 11 | This document is to describe the functionality a project MUST provide in terms of creating build artifacts. It also describes the structure in which project's MUST write build artifacts in. 12 | 13 | A project MUST provide: 14 | 15 | - a folder name convention for build artifacts 16 | - a folder structure for the above-mentioned build artifacts folder 17 | - a list of targets 18 | - a file called `bin/build.{target}.{ext}` to target each of the build targets 19 | - a build pipeline given the above pretext 20 | 21 | The purpose of having a uniform way of producing a build is that we may ALL produce builds for any of the projects, making the onramp for new developers less steep, while still maintaining an exceptionally high level of quality. 22 | 23 | The projects should follow the 'architecture as code' principle - and should require a very minimal set of dependencies. 24 | 25 | It is the responsibilty of the build tooling to write artifacts to the appropriate location as outlined in this specification. 26 | 27 | ## Build Folder Name 28 | 29 | The cannonical folder for builds SHALL be named `build` and be located at the root of the project repository. 30 | Each project MUST `git ignore` the `build` folder. 31 | 32 | ## Build Folder Structure 33 | 34 | Files and folder names MUST be lowercase. 35 | The result of the build process should create a folder structure as follows: 36 | 37 | ``` 38 | . 39 | └── build 40 | └── {target} 41 | └── {project-name}.{ext} 42 | ``` 43 | 44 | 45 | Below is an example: 46 | ``` 47 | . 48 | └── build 49 | └── windows 50 | └── my-build.exe 51 | ``` 52 | 53 | ## Build Targets 54 | 55 | Below is a list of suggested targets for a project 56 | 1. windows 57 | 2. linux 58 | 3. macos 59 | 60 | ## Build script 61 | 62 | Each release target MUST have a `bin/build.{target}.{ext}` file. 63 | 64 | The result of this is that every project MUST produce a build for each target when the following command is invoked: 65 | 66 | ``` 67 | bin/build.{target}.{ext}` 68 | ``` 69 | 70 | The file MUST be placed in the project's `bin` directory. 71 | 72 | ## Build Pipeline 73 | 74 | ### Building targets 75 | 76 | `bin/build.{target}.{ext}` should create builds for each of the targets, and place the build artifacts in a folder structure outlined above. 77 | 78 | ### Windows 79 | 80 | ``` 81 | bin/build.windows.bat 82 | ``` 83 | 84 | ### Linux 85 | 86 | ``` 87 | bin/build.linux.sh 88 | ``` 89 | 90 | ### Macos 91 | 92 | ``` 93 | bin/build.macos.sh 94 | ``` 95 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | > This document is inspired by [elasticsearch/CONTRIBUTING.md](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md) 4 | 5 | Adding a `CONTRIBUTING.md` to a Github repository enables a link to that file in the pull request or create an issue page. This document should guide potential contributors toward making a successful and meaningful impact on the project, and can save maintainers time and hassle caused by improper pull requests and issues. You can learn more about the features that are enabled by Github when this file is present [here](https://help.github.com/articles/setting-guidelines-for-repository-contributors/). 6 | 7 | ## How to contribute 8 | 9 | There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, [submitting Github issues](https://help.github.com/articles/creating-an-issue/), bug reports, feature requests and writing code. 10 | 11 | ## License 12 | 13 | This repository uses the [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). 14 | 15 | ## Bug reports 16 | 17 | If you think you've found a bug in the software, first make sure you're testing against the *latest* version of the software -- your issue may have been fixed already. If it's not, please check out the issues list on Github and search for similar issues that have already been opened. If there are no issues then please [submit a Github issue](https://help.github.com/articles/creating-an-issue/). 18 | 19 | If you can provide a small test case it would greatly help the reproduction of a bug, as well as a a screenshot, and any other information you can provide. 20 | 21 | 22 | ## Feature Requests 23 | 24 | If there are features that do not exist yet, we are definitely open to feature requests and detailed proposals. [Open an issue](https://help.github.com/articles/creating-an-issue/) on our Github which describes the feature or proposal in detail, answer questions like why? how? 25 | 26 | ## Contributing Code and Documentation Changes 27 | 28 | Bug fixes, patches and new features are welcome. Please find or open an issue about it first. Talk about what exactly want to do, someone may already be working on it, or there might be some issues that you need to be aware of before implementing the fix. 29 | 30 | There are many ways to fix a problem and it is important to find the best approach before writing a ton of code. 31 | 32 | ##### Documentation Changes 33 | 34 | For small documentation changes and fixes, these can be done quickly following this video guide on [how to contribute to Open Source in 1 minute on Github](https://www.youtube.com/watch?v=kRYk1-yKwWs). 35 | 36 | ### Forking the repository 37 | 38 | [How to fork a repository](https://help.github.com/articles/fork-a-repo/). 39 | 40 | ### Submitting changes 41 | 42 | 1. Review & Test changes 43 | * If the code changed, then test it. If documentation changed, then preview the rendered Markdown. 44 | 2. Commiting 45 | * Follow the [Convention Commits](CONVENTIONAL_COMMITS.md) guidelines to create a commit message 46 | 3. Sign the CLA 47 | * Make sure you've signed the repository's Contributor License Agreement. We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once. 48 | 4. Submit a pull request 49 | * Push local changes to your forked repository and make a pull request. Follow the [Convention Commits](CONVENTIONAL_COMMITS.md) guidelines for naming Github pull requests and what to put in the body. 50 | 51 | 52 | ## Building 53 | 54 | Follow the build process is outlined in [BUILDING.md](BUILDING.md) to create a build. 55 | 56 | 57 | ## Releasing 58 | 59 | Follow the release process is outlined in [RELEASING.md](RELEASING.md) to create a release. 60 | 61 | 62 | -------------------------------------------------------------------------------- /CONVENTIONAL_COMMITS.md: -------------------------------------------------------------------------------- 1 | # Conventional Commits 1.0.0-beta.2 2 | 3 | > This spec is a direct copy from [http://conventionalcommits.org](http://conventionalcommits.org). It lives here as a reference document for new contributors. 4 | 5 | ## Summary 6 | 7 | The [Conventional Commits](http://conventionalcommits.org) specification is a lightweight convention on top of commit messages. 8 | It provides an easy set of rules for creating an explicit commit history; 9 | which makes it easier to write automated tools on top of. 10 | This convention dovetails with [SemVer](http://semver.org), 11 | by describing the features, fixes, and breaking changes made in commit messages. 12 | 13 | The commit message should be structured as follows: 14 | 15 | --- 16 | 17 | ``` 18 | [optional scope]: 19 | 20 | [optional body] 21 | 22 | [optional footer] 23 | ``` 24 | --- 25 | 26 |
27 | The commit contains the following structural elements, to communicate intent to the 28 | consumers of your library: 29 | 30 | 1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with [`PATCH`](http://semver.org/#summary) in semantic versioning). 31 | 1. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with [`MINOR`](http://semver.org/#summary) in semantic versioning). 32 | 1. **BREAKING CHANGE:** a commit that has the text `BREAKING CHANGE:` at the beginning of its optional body or footer section introduces a breaking API change (correlating with [`MAJOR`](http://semver.org/#summary) in semantic versioning). 33 | A BREAKING CHANGE can be part of commits of any _type_. 34 | 1. Others: commit _types_ other than `fix:` and `feat:` are allowed, for example [commitlint-config-conventional](https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional) (based on the [the Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines)) recommends `chore:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others. 35 | We also recommend `improvement` for commits that improve a current implementation without adding a new feature or fixing a bug. 36 | Notice these types are not mandated by the conventional commits specification, and have no implicit effect in semantic versioning (unless they include a BREAKING CHANGE). 37 |
38 | A scope may be provided to a commit's type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`. 39 | 40 | ## Examples 41 | 42 | ### Commit message with description and breaking change in body 43 | ``` 44 | feat: allow provided config object to extend other configs 45 | 46 | BREAKING CHANGE: `extends` key in config file is now used for extending other config files 47 | ``` 48 | 49 | ### Commit message with no body 50 | ``` 51 | docs: correct spelling of CHANGELOG 52 | ``` 53 | 54 | ### Commit message with scope 55 | ``` 56 | feat(lang): added polish language 57 | ``` 58 | 59 | ### Commit message for a fix using an (optional) issue number. 60 | ``` 61 | fix: minor typos in code 62 | 63 | see the issue for details on the typos fixed 64 | 65 | fixes issue #12 66 | ``` 67 | ## Specification 68 | 69 | The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt). 70 | 71 | 1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by a colon and a space. 72 | 1. The type `feat` MUST be used when a commit adds a new feature to your application or library. 73 | 1. The type `fix` MUST be used when a commit represents a bug fix for your application. 74 | 1. An optional scope MAY be provided after a type. A scope is a phrase describing a section of the codebase enclosed in parenthesis, e.g., `fix(parser):` 75 | 1. A description MUST immediately follow the type/scope prefix. 76 | The description is a short description of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string._ 77 | 1. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description. 78 | 1. A footer MAY be provided one blank line after the body. 79 | The footer SHOULD contain additional issue references about the code changes (such as the issues it fixes, e.g.,`Fixes #13`). 80 | 1. Breaking changes MUST be indicated at the very beginning of the footer or body section of a commit. A breaking change MUST consist of the uppercase text `BREAKING CHANGE`, followed by a colon and a space. 81 | 1. A description MUST be provided after the `BREAKING CHANGE: `, describing what has changed about the API, e.g., _BREAKING CHANGE: environment variables now take precedence over config files._ 82 | 1. The footer MUST only contain `BREAKING CHANGE`, external links, issue references, and other meta-information. 83 | 1. Types other than `feat` and `fix` MAY be used in your commit messages. 84 | 85 | ## Why Use Conventional Commits 86 | 87 | * Automatically generating CHANGELOGs. 88 | * Automatically determining a semantic version bump (based on the types of commits landed). 89 | * Communicating the nature of changes to teammates, the public, and other stakeholders. 90 | * Triggering build and publish processes. 91 | * Making it easier for people to contribute to your projects, by allowing them to explore 92 | a more structured commit history. 93 | 94 | ## FAQ 95 | 96 | ### How should I deal with commit messages in the initial development phase? 97 | 98 | We recommend that you proceed as if you've an already released product. Typically *somebody*, even if its your fellow software developers, is using your software. They'll want to know what's fixed, what breaks etc. 99 | 100 | ### Are the types in the commit title uppercase or lowercase? 101 | 102 | Any casing may be used, but it's best to be consistent. 103 | 104 | ### What do I do if the commit conforms to more than one of the commit types? 105 | 106 | Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs. 107 | 108 | ### Doesn’t this discourage rapid development and fast iteration? 109 | 110 | It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors. 111 | 112 | ### Might Conventional Commits lead developers to limit the type of commits they make because they'll be thinking in the types provided? 113 | 114 | Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time. 115 | 116 | ### How does this relate to SemVer? 117 | 118 | `fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases. 119 | 120 | ### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`? 121 | 122 | We recommend using SemVer to release your own extensions to this specification (and 123 | encourage you to make these extensions!) 124 | 125 | ### What do I do if I accidentally use the wrong commit type? 126 | 127 | #### When you used a type that's of the spec but not the correct type, e.g. `fix` instead of `feat` 128 | 129 | Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use. 130 | 131 | #### When you used a type *not* of the spec, e.g. `feet` instead of `feat` 132 | 133 | In a worst case scenario, it's not the end of the world if a commit lands that does not meet the conventional commit specification. It simply means that commit will be missed by tools that are based on the spec. 134 | 135 | ### Do all my contributors need to use the conventional commit specification? 136 | 137 | No! If you use a squash based workflow on Git lead maintainers can cleanup the commit messages as they're merged—adding no workload to casual committers. 138 | A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge. 139 | 140 | ## About 141 | 142 | The Conventional Commit specification is inspired by, and based heavily on, the [Angular Commit Guidelines](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines). 143 | 144 | The first draft of this specification has been written in collaboration with some of the folks contributing to: 145 | 146 | * [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog): a set of tools for parsing conventional commit messages from git histories. 147 | * [bumped](https://bumped.github.io): a tool for releasing software that makes it easy to perform actions before and after releasing a new version of your software. 148 | * [unleash](https://github.com/netflix/unleash): a tool for automating the software release and publishing lifecycle. 149 | * [lerna](https://github.com/lerna/lerna): a tool for managing monorepos, which grew out of the Babel project. 150 | 151 | ## Tooling for Conventional Commits 152 | 153 | * [conform](https://github.com/autonomy/conform): a tool that can be used to enforce policies on git repositories, including conventional commits. 154 | 155 | ## Projects Using Conventional Commits 156 | 157 | * [yargs](https://github.com/yargs/yargs): everyone's favorite pirate themed command line argument parser. 158 | * [istanbuljs](https://github.com/istanbuljs/istanbuljs): a collection of open-source tools and libraries for adding test coverage to your JavaScript tests. 159 | * [standard-version](https://github.com/conventional-changelog/standard-version): Automatic versioning and CHANGELOG management, using GitHub's new squash button and the recommended Conventional Commits workflow. 160 | * [uPortal-home](https://github.com/UW-Madison-DoIT/angularjs-portal) and [uPortal-application-framework](https://github.com/UW-Madison-DoIT/uw-frame): Optional supplemental user interface enhancing [Apereo uPortal](https://www.apereo.org/projects/uportal). 161 | * [massive.js](https://github.com/dmfay/massive-js): A data access library for Node and PostgreSQL. 162 | * [electron](https://github.com/electron/electron): Build cross-platform desktop apps with JavaScript, HTML, and CSS. 163 | * [scroll-utility](https://github.com/LeDDGroup/scroll-utility): A simple to use scroll utility package for centering elements, and smooth animations 164 | * [Blaze UI](https://github.com/BlazeUI/blaze): Framework-free open source modular toolkit. 165 | 166 | [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) 167 | 168 | _want your project on this list?_ [send a pull request](https://github.com/conventional-changelog/conventionalcommits.org/pulls). 169 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent none 3 | stages { 4 | stage('Run Tests') { 5 | parallel { 6 | stage('flint checker') { 7 | agent { 8 | label 'macos' 9 | } 10 | steps { 11 | sh '/usr/local/bin/brew install flint-checker' 12 | sh 'ls -al' 13 | sh '/usr/local/bin/flint --skip-changelog --skip-bootstrap --skip-test-script --skip-code-of-conduct' 14 | } 15 | } 16 | stage('linux') { 17 | agent { 18 | label 'linux' 19 | } 20 | steps { 21 | sh 'echo "linux hello world"' 22 | } 23 | } 24 | stage('windows') { 25 | agent { 26 | label 'windows' 27 | } 28 | steps { 29 | bat 'echo "windows hello world"' 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # examples 2 | 3 |
4 | 5 | CircleCI branch 6 | npm 7 | GitHub release 8 | GitHub commits since latest release 9 | 10 |
11 | 12 | Collection of example OpenRPC Documents 13 | 14 | Need help or have a question? Join us on [Discord](https://discord.gg/gREUKuF)! 15 | 16 | ### Contributing 17 | 18 | How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification. 19 | 20 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing 2 | 3 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. 4 | 5 | This document is licensed under [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). 6 | 7 | When using the name 'version' we mean the versioning scheme described in [VERSIONING.md](VERSIONING.md) 8 | 9 | ## Introduction 10 | 11 | This document is to describe the release pipeline, which is taking the result of the artifacts created according to [BUILDING.md](BUILDING.md) and publish a release to the various release targets for the project. 12 | 13 | We propose: 14 | - a set of release targets that are allowable 15 | - a pipeline for handling the release folder's artifacts 16 | 17 | It is NOT the purpose of this document to describe how a project might create a build, NOR is it describing a strcture in which projects MUST write build artifacts to. It is describing the structure of the releases themselves. 18 | 19 | ## Release Pipeline 20 | 21 | ### Create a build from current branch 22 | 23 | Process is outlined in [BUILDING.md](BUILDING.md) 24 | 25 | 1. Clean the build directory 26 | 2. run: `bin/build.{target}.{ext}` 27 | 28 | ### Bump the version of the project 29 | 30 | Projects SHOULD automate the version bump following [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md). 31 | 32 | ### Generate Changelog 33 | 34 | Projects SHOULD use generated changelogs from following [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md). 35 | 36 | ### Commit the bump + changelog update 37 | 38 | A project MUST generate a commit with the changes. 39 | 40 | ### Tag the commit with the bumped version 41 | 42 | A project MUST be tagged with the semantic versioning scheme from [VERSIONING.md](VERSIONING.md). 43 | 44 | ### Sign the releases. 45 | 46 | - MUST be a pgp signature 47 | - MUST be the same pgp key as is registered with Github 48 | - MUST be a detached ascii-armored (.asc) signature 49 | - All files in the build folder MUST have an associated signature file 50 | 51 | ### Push changelog & version bump 52 | 53 | ### Run Release Targets 54 | 55 | For each of the desired release targets, prepare and push the release. 56 | 57 | #### Example Release Targets 58 | 59 | 1. Github 60 | 2. Docker Hub 61 | 62 | ## Resources 63 | 64 | - [semantic-release](https://github.com/semantic-release/semantic-release) 65 | - [Conventional Commits](https://conventionalcommits.org/) 66 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # How to setup tests 2 | 3 | Testing is a project specific concern. That being said, each project may use a jenkins pipeline to setup CI and CD for the project. 4 | 5 | We use [jenkins-vagrant](https://github.com/etclabscore/jenkins-vagrant) 6 | 7 | Here is an example [jenkinsfile](https://jenkins.io/doc/book/pipeline/jenkinsfile/) that runs node project tests in each of osx, linux and windows: 8 | 9 | ``` 10 | pipeline { 11 | agent none 12 | stages { 13 | stage('Run Tests') { 14 | parallel { 15 | stage('test') { 16 | agent { 17 | label 'macos' 18 | } 19 | steps { 20 | sh 'npm install' 21 | sh 'npm test' 22 | } 23 | } 24 | stage('linux') { 25 | agent { 26 | label 'linux' 27 | } 28 | steps { 29 | sh 'npm install' 30 | sh 'npm test' 31 | } 32 | } 33 | stage('windows') { 34 | agent { 35 | label 'windows' 36 | } 37 | steps { 38 | bat 'npm install' 39 | bat 'npm test' 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | ``` 47 | -------------------------------------------------------------------------------- /VERSIONING.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. 4 | 5 | This document is licensed under [The Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). 6 | 7 | ## Introduction 8 | This document is to describe how a project is to version its releases 9 | 10 | It also describes standardized tooling around manipulating the version 11 | 12 | ## Semver 13 | A project MUST use Semantic Versioning [semver](https://semver.org). Build metadata MAY NOT be used in a project. Build metadata SHOULD be ignored. 14 | 15 | A Basic summary of Semantic Versioning taken from: [semver.org](https://semver.org) 16 | 17 | ### Summary: 18 | 19 | Given a version number MAJOR.MINOR.PATCH, increment the: 20 | 21 | MAJOR version when you make incompatible API changes, 22 | MINOR version when you add functionality in a backwards-compatible manner, and 23 | PATCH version when you make backwards-compatible bug fixes. 24 | Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. 25 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | coverageDirectory: '../coverage', 4 | resetMocks: true, 5 | restoreMocks: true, 6 | rootDir: './src', 7 | testEnvironment: 'node', 8 | preset: 'ts-jest', 9 | } 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@open-rpc/examples", 3 | "version": "0.0.0-semantic-dev", 4 | "description": "Collection of example OpenRPC service definition files", 5 | "main": "build/src/index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "test": "npm run build && jest", 9 | "publish": "npm run test && npm run build", 10 | "test:watch": "npm run test -- --watch", 11 | "lint": "eslint . --ext .ts" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/open-rpc/examples.git" 16 | }, 17 | "author": "", 18 | "license": "Apache-2.0", 19 | "bugs": { 20 | "url": "https://github.com/open-rpc/examples/issues" 21 | }, 22 | "homepage": "https://spec.open-rpc.org", 23 | "files": [ 24 | "build", 25 | "!build/**/*.test.*" 26 | ], 27 | "dependencies": {}, 28 | "devDependencies": { 29 | "@open-rpc/meta-schema": "^1.14.9", 30 | "@open-rpc/schema-utils-js": "^2.0.2", 31 | "@types/jest": "^29.5.12", 32 | "@types/node": "^15.12.2", 33 | "@typescript-eslint/eslint-plugin": "^4.11.1", 34 | "@typescript-eslint/parser": "^4.11.1", 35 | "eslint": "^7.17.0", 36 | "jest": "^29.7.0", 37 | "ts-jest": "^29.1.2", 38 | "typescript": "^4.9.5" 39 | }, 40 | "keywords": [ 41 | "open-rpc", 42 | "OpenRPC", 43 | "openrpc", 44 | "JSON schema", 45 | "JSON RPC", 46 | "API" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /service-descriptions/api-with-examples-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "title": "Simple RPC overview", 5 | "version": "2.0.0" 6 | }, 7 | "methods": [ 8 | { 9 | "name": "get_versions", 10 | "summary": "List API versions", 11 | "params": [], 12 | "result": { 13 | "name": "get_version_result", 14 | "schema": { 15 | "type": "object" 16 | } 17 | }, 18 | "examples": [ 19 | { 20 | "name": "v2", 21 | "summary": "its a v2 example pairing!", 22 | "description": "aight so this is how it works. You foo the bar then you baz the razmataz", 23 | "params": [], 24 | "result": { 25 | "name": "versionsExample", 26 | "value": { 27 | "versions": [ 28 | { 29 | "status": "CURRENT", 30 | "updated": "2011-01-21T11:33:21Z", 31 | "id": "v2.0", 32 | "urls": [ 33 | { 34 | "href": "http://127.0.0.1:8774/v2/", 35 | "rel": "self" 36 | } 37 | ] 38 | }, 39 | { 40 | "status": "EXPERIMENTAL", 41 | "updated": "2013-07-23T11:33:21Z", 42 | "id": "v3.0", 43 | "urls": [ 44 | { 45 | "href": "http://127.0.0.1:8774/v3/", 46 | "rel": "self" 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | } 53 | } 54 | ] 55 | }, 56 | { 57 | "name": "get_version_details", 58 | "summary": "Show API version details", 59 | "params": [], 60 | "result": { 61 | "name": "foo", 62 | "schema": { 63 | "type": "string" 64 | } 65 | }, 66 | "examples": [ 67 | { 68 | "name": "stringifiedVersionsExample", 69 | "params": [], 70 | "result": { 71 | "name": "bliggityblaow", 72 | "value": "{\n \"versions\": [\n {\n \"status\": \"CURRENT\",\n \"updated\": \"2011-01-21T11:33:21Z\",\n \"id\": \"v2.0\",\n \"urls\": [\n {\n \"href\": \"http://127.0.0.1:8774/v2/\",\n \"rel\": \"self\"\n }\n ]\n },\n {\n \"status\": \"EXPERIMENTAL\",\n \"updated\": \"2013-07-23T11:33:21Z\",\n \"id\": \"v3.0\",\n \"urls\": [\n {\n \"href\": \"http://127.0.0.1:8774/v3/\",\n \"rel\": \"self\"\n }\n ]\n }\n ]\n}\n" 73 | } 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /service-descriptions/empty-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.2.4", 3 | "info": { 4 | "title": "", 5 | "version": "1.0.0" 6 | }, 7 | "methods": [] 8 | } 9 | -------------------------------------------------------------------------------- /service-descriptions/link-example-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "title": "Links", 5 | "version": "1.0.0" 6 | }, 7 | "methods": [ 8 | { 9 | "name": "get_user_by_name", 10 | "params": [ 11 | { 12 | "name": "username", 13 | "required": true, 14 | "schema": { 15 | "type": "string" 16 | } 17 | } 18 | ], 19 | "result": { 20 | "name": "user", 21 | "description": "The User", 22 | "schema": { 23 | "$ref": "#/components/schemas/user" 24 | } 25 | }, 26 | "links": [ 27 | { "$ref": "#/components/links/UserRepositories" } 28 | ] 29 | }, 30 | { 31 | "name": "get_repositories_by_owner", 32 | "params": [ 33 | { 34 | "name": "username", 35 | "required": true, 36 | "schema": { 37 | "type": "string" 38 | } 39 | } 40 | ], 41 | "result": { 42 | "name": "repositories", 43 | "description": "repositories owned by the supplied user", 44 | "schema": { 45 | "type": "array", 46 | "items": { 47 | "$ref": "#/components/schemas/repository" 48 | } 49 | } 50 | }, 51 | "links": [ 52 | { 53 | "$ref": "#/components/links/UserRepository" 54 | } 55 | ] 56 | }, 57 | { 58 | "name": "get_repository", 59 | "params": [ 60 | { 61 | "name": "username", 62 | "required": true, 63 | "schema": { 64 | "type": "string" 65 | } 66 | }, 67 | { 68 | "name": "slug", 69 | "required": true, 70 | "schema": { 71 | "type": "string" 72 | } 73 | } 74 | ], 75 | "result": { 76 | "name": "repository", 77 | "description": "The repository", 78 | "schema": { 79 | "$ref": "#/components/schemas/repository" 80 | } 81 | }, 82 | "links": [ 83 | { 84 | "$ref": "#/components/links/RepositoryPullRequests" 85 | } 86 | ] 87 | }, 88 | { 89 | "name": "get_pull_requests_by_repository", 90 | "params": [ 91 | { 92 | "name": "username", 93 | "required": true, 94 | "schema": { 95 | "type": "string" 96 | } 97 | }, 98 | { 99 | "name": "slug", 100 | "required": true, 101 | "schema": { 102 | "type": "string" 103 | } 104 | }, 105 | { 106 | "name": "state", 107 | "schema": { 108 | "type": "string", 109 | "enum": [ 110 | "open", 111 | "merged", 112 | "declined" 113 | ] 114 | } 115 | } 116 | ], 117 | "result": { 118 | "name": "pullrequests", 119 | "description": "an array of pull request objects", 120 | "schema": { 121 | "type": "array", 122 | "items": { 123 | "$ref": "#/components/schemas/pullrequest" 124 | } 125 | } 126 | } 127 | }, 128 | { 129 | "name": "get_pull_requests_by_id", 130 | "params": [ 131 | { 132 | "name": "username", 133 | "required": true, 134 | "schema": { 135 | "type": "string" 136 | } 137 | }, 138 | { 139 | "name": "slug", 140 | "required": true, 141 | "schema": { 142 | "type": "string" 143 | } 144 | }, 145 | { 146 | "name": "pid", 147 | "required": true, 148 | "schema": { 149 | "type": "string" 150 | } 151 | } 152 | ], 153 | "result": { 154 | "name": "pullrequest", 155 | "description": "a pull request object", 156 | "schema": { 157 | "$ref": "#/components/schemas/pullrequest" 158 | } 159 | }, 160 | "links": [ 161 | { "$ref": "#/components/links/PullRequestMerge" } 162 | ] 163 | }, 164 | { 165 | "name": "merge_pull_request", 166 | "params": [ 167 | { 168 | "name": "username", 169 | "required": true, 170 | "schema": { 171 | "type": "string" 172 | } 173 | }, 174 | { 175 | "name": "slug", 176 | "required": true, 177 | "schema": { 178 | "type": "string" 179 | } 180 | }, 181 | { 182 | "name": "pid", 183 | "required": true, 184 | "schema": { 185 | "type": "string" 186 | } 187 | } 188 | ], 189 | "result": { 190 | "name": "merged", 191 | "description": "the PR was successfully merged", 192 | "schema": {} 193 | } 194 | } 195 | ], 196 | "components": { 197 | "links": { 198 | "UserRepositories": { 199 | "description": "Get the repositories by owner.", 200 | "summary": "Get the repos by owner", 201 | "server":{ 202 | "name": "Other Server Name", 203 | "description": "Use other server instead", 204 | "url": "http://localhost:9210" 205 | }, 206 | "method": "get_repositories_by_owner", 207 | "params": { 208 | "username": "${result.username}" 209 | } 210 | }, 211 | "UserRepository": { 212 | "method": "getRepository", 213 | "params": { 214 | "username": "${result.owner.username}", 215 | "slug": "${result.slug}" 216 | } 217 | }, 218 | "RepositoryPullRequests": { 219 | "method": "getPullRequestsByRepository", 220 | "params": { 221 | "username": "${result.owner.username}", 222 | "slug": "${result.slug}" 223 | } 224 | }, 225 | "PullRequestMerge": { 226 | "method": "mergePullRequest", 227 | "params": { 228 | "username": "${result.author.username}", 229 | "slug": "${result.repository.slug}", 230 | "pid": "${result.id}" 231 | } 232 | } 233 | }, 234 | "schemas": { 235 | "user": { 236 | "type": "object", 237 | "properties": { 238 | "username": { 239 | "type": "string" 240 | }, 241 | "uuid": { 242 | "type": "string" 243 | } 244 | } 245 | }, 246 | "repository": { 247 | "type": "object", 248 | "properties": { 249 | "slug": { 250 | "type": "string" 251 | }, 252 | "owner": { 253 | "$ref": "#/components/schemas/user" 254 | } 255 | } 256 | }, 257 | "pullrequest": { 258 | "type": "object", 259 | "properties": { 260 | "id": { 261 | "type": "integer" 262 | }, 263 | "title": { 264 | "type": "string" 265 | }, 266 | "repository": { 267 | "$ref": "#/components/schemas/repository" 268 | }, 269 | "author": { 270 | "$ref": "#/components/schemas/user" 271 | } 272 | } 273 | } 274 | } 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /service-descriptions/metrics-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.3.0", 3 | "info": { 4 | "title": "Metrics", 5 | "description": "An example of a metrics service that uses notification-only methods", 6 | "version": "1.0.0" 7 | }, 8 | "servers": [], 9 | "methods": [ 10 | { 11 | "name": "link_clicked", 12 | "params": [ 13 | { 14 | "name": "link href", 15 | "schema": { 16 | "title": "href", 17 | "type": "string", 18 | "format": "uri" 19 | } 20 | }, 21 | { 22 | "name": "link label", 23 | "schema": { 24 | "title": "label", 25 | "type": "string" 26 | } 27 | } 28 | ], 29 | "examples": [ 30 | { 31 | "name": "login link clicked", 32 | "params": [ 33 | { 34 | "name": "link href", 35 | "value": "https://open-rpc.org" 36 | }, 37 | { 38 | "name": "link label", 39 | "value": "Visit the OpenRPC Homepage" 40 | } 41 | ] 42 | } 43 | ] 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /service-descriptions/params-by-name-petstore-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "1.0.0", 5 | "title": "Petstore By Name", 6 | "license": { 7 | "name": "MIT" 8 | } 9 | }, 10 | "servers": [ 11 | { 12 | "url": "http://localhost:8080" 13 | } 14 | ], 15 | "methods": [ 16 | { 17 | "name": "list_pets", 18 | "summary": "List all pets", 19 | "paramStructure": "by-name", 20 | "tags": [ 21 | { 22 | "name": "pets" 23 | } 24 | ], 25 | "params": [ 26 | { 27 | "name": "limit", 28 | "description": "How many items to return at one time (max 100)", 29 | "required": false, 30 | "schema": { 31 | "type": "integer" 32 | } 33 | } 34 | ], 35 | "result": { 36 | "name": "pets", 37 | "description": "A paged array of pets", 38 | "schema": { 39 | "$ref": "#/components/schemas/Pets" 40 | } 41 | }, 42 | "examples": [ 43 | { 44 | "name": "listPetExample", 45 | "description": "List pet example", 46 | "params": [ 47 | { 48 | "name": "limit", 49 | "value": 1 50 | } 51 | ], 52 | "result": { 53 | "name": "listPetResultExample", 54 | "value": [ 55 | { 56 | "id": 7, 57 | "name": "fluffy", 58 | "tag": "poodle" 59 | } 60 | ] 61 | } 62 | } 63 | ] 64 | }, 65 | { 66 | "name": "create_pet", 67 | "summary": "Create a pet", 68 | "paramStructure": "by-name", 69 | "tags": [ 70 | { 71 | "name": "pets" 72 | } 73 | ], 74 | "params": [], 75 | "result": { 76 | "name": "null", 77 | "description": "Null response", 78 | "schema": { 79 | "type": "null" 80 | } 81 | } 82 | }, 83 | { 84 | "name": "get_pet", 85 | "summary": "Info for a specific pet", 86 | "tags": [ 87 | { 88 | "name": "pets" 89 | } 90 | ], 91 | "paramStructure": "by-position", 92 | "params": [ 93 | { 94 | "name": "petId", 95 | "required": true, 96 | "description": "The id of the pet to retrieve", 97 | "schema": { 98 | "type": "string" 99 | } 100 | } 101 | ], 102 | "result": { 103 | "name": "pets", 104 | "description": "Expected response to a valid request", 105 | "schema": { 106 | "$ref": "#/components/schemas/Pets" 107 | } 108 | } 109 | } 110 | ], 111 | "components": { 112 | "schemas": { 113 | "Pet": { 114 | "required": [ 115 | "id", 116 | "name" 117 | ], 118 | "properties": { 119 | "id": { 120 | "type": "integer" 121 | }, 122 | "name": { 123 | "type": "string" 124 | }, 125 | "tag": { 126 | "type": "string" 127 | } 128 | } 129 | }, 130 | "Pets": { 131 | "type": "array", 132 | "items": { 133 | "$ref": "#/components/schemas/Pet" 134 | } 135 | } 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /service-descriptions/petstore-expanded-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "1.0.0", 5 | "title": "Petstore Expanded", 6 | "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenRPC specification", 7 | "termsOfService": "https://open-rpc.org", 8 | "contact": { 9 | "name": "OpenRPC Team", 10 | "email": "doesntexist@open-rpc.org", 11 | "url": "https://open-rpc.org" 12 | }, 13 | "license": { 14 | "name": "Apache 2.0", 15 | "url": "https://www.apache.org/licenses/LICENSE-2.0.html" 16 | } 17 | }, 18 | "servers": [ 19 | { 20 | "url": "http://petstore.open-rpc.org" 21 | } 22 | ], 23 | "methods": [ 24 | { 25 | "name": "get_pets", 26 | "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam.", 27 | "params": [ 28 | { 29 | "name": "tags", 30 | "description": "tags to filter by", 31 | "schema": { 32 | "type": "array", 33 | "items": { 34 | "type": "string" 35 | } 36 | } 37 | }, 38 | { 39 | "name": "limit", 40 | "description": "maximum number of results to return", 41 | "schema": { 42 | "type": "integer" 43 | } 44 | } 45 | ], 46 | "result": { 47 | "name": "pet", 48 | "description": "pet response", 49 | "schema": { 50 | "type": "array", 51 | "items": { 52 | "$ref": "#/components/schemas/Pet" 53 | } 54 | } 55 | } 56 | }, 57 | { 58 | "name": "create_pet", 59 | "description": "Creates a new pet in the store. Duplicates are allowed", 60 | "params": [ 61 | { 62 | "name": "newPet", 63 | "description": "Pet to add to the store.", 64 | "schema": { 65 | "$ref": "#/components/schemas/NewPet" 66 | } 67 | } 68 | ], 69 | "result": { 70 | "name": "pet", 71 | "description": "the newly created pet", 72 | "schema": { 73 | "$ref": "#/components/schemas/Pet" 74 | } 75 | } 76 | }, 77 | { 78 | "name": "get_pet_by_id", 79 | "description": "Returns a user based on a single ID, if the user does not have access to the pet", 80 | "params": [ 81 | { 82 | "name": "id", 83 | "description": "ID of pet to fetch", 84 | "required": true, 85 | "schema": { 86 | "type": "integer" 87 | } 88 | } 89 | ], 90 | "result": { 91 | "name": "pet", 92 | "description": "pet response", 93 | "schema": { 94 | "$ref": "#/components/schemas/Pet" 95 | } 96 | } 97 | }, 98 | { 99 | "name": "delete_pet_by_id", 100 | "description": "deletes a single pet based on the ID supplied", 101 | "params": [ 102 | { 103 | "name": "id", 104 | "description": "ID of pet to delete", 105 | "required": true, 106 | "schema": { 107 | "type": "integer" 108 | } 109 | } 110 | ], 111 | "result": { 112 | "name": "pet", 113 | "description": "pet deleted", 114 | "schema": {} 115 | } 116 | } 117 | ], 118 | "components": { 119 | "schemas": { 120 | "Pet": { 121 | "allOf": [ 122 | { 123 | "$ref": "#/components/schemas/NewPet" 124 | }, 125 | { 126 | "required": [ 127 | "id" 128 | ], 129 | "properties": { 130 | "id": { 131 | "type": "integer" 132 | } 133 | } 134 | } 135 | ] 136 | }, 137 | "NewPet": { 138 | "type": "object", 139 | "required": [ 140 | "name" 141 | ], 142 | "properties": { 143 | "name": { 144 | "type": "string" 145 | }, 146 | "tag": { 147 | "type": "string" 148 | } 149 | } 150 | } 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /service-descriptions/petstore-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "1.0.0", 5 | "title": "Petstore", 6 | "license": { 7 | "name": "MIT" 8 | } 9 | }, 10 | "servers": [ 11 | { 12 | "url": "http://localhost:8080" 13 | } 14 | ], 15 | "methods": [ 16 | { 17 | "name": "list_pets", 18 | "summary": "List all pets", 19 | "tags": [ 20 | { 21 | "name": "pets" 22 | } 23 | ], 24 | "params": [ 25 | { 26 | "name": "limit", 27 | "description": "How many items to return at one time (max 100)", 28 | "required": false, 29 | "schema": { 30 | "type": "integer", 31 | "minimum": 1 32 | } 33 | } 34 | ], 35 | "result": { 36 | "name": "pets", 37 | "description": "A paged array of pets", 38 | "schema": { 39 | "$ref": "#/components/schemas/Pets" 40 | } 41 | }, 42 | "errors": [ 43 | { 44 | "code": 100, 45 | "message": "pets busy" 46 | } 47 | ], 48 | "examples": [ 49 | { 50 | "name": "listPetExample", 51 | "description": "List pet example", 52 | "params": [ 53 | { 54 | "name": "limit", 55 | "value": 1 56 | } 57 | ], 58 | "result": { 59 | "name": "listPetResultExample", 60 | "value": [ 61 | { 62 | "id": 7, 63 | "name": "fluffy", 64 | "tag": "poodle" 65 | } 66 | ] 67 | } 68 | } 69 | ] 70 | }, 71 | { 72 | "name": "create_pet", 73 | "summary": "Create a pet", 74 | "tags": [ 75 | { 76 | "name": "pets" 77 | } 78 | ], 79 | "params": [ 80 | { 81 | "name": "newPetName", 82 | "description": "Name of pet to create", 83 | "required": true, 84 | "schema": { 85 | "type": "string" 86 | } 87 | }, 88 | { 89 | "name": "newPetTag", 90 | "description": "Pet tag to create", 91 | "schema": { 92 | "type": "string" 93 | } 94 | } 95 | ], 96 | "examples": [ 97 | { 98 | "name": "createPetExample", 99 | "description": "Create pet example", 100 | "params": [ 101 | { 102 | "name": "newPetName", 103 | "value": "fluffy" 104 | }, 105 | { 106 | "name": "tag", 107 | "value": "poodle" 108 | } 109 | ], 110 | "result": { 111 | "name": "listPetResultExample", 112 | "value": 7 113 | } 114 | } 115 | ], 116 | "result": { 117 | "$ref": "#/components/contentDescriptors/PetId" 118 | } 119 | }, 120 | { 121 | "name": "get_pet", 122 | "summary": "Info for a specific pet", 123 | "tags": [ 124 | { 125 | "name": "pets" 126 | } 127 | ], 128 | "params": [ 129 | { 130 | "$ref": "#/components/contentDescriptors/PetId" 131 | } 132 | ], 133 | "result": { 134 | "name": "pet", 135 | "description": "Expected response to a valid request", 136 | "schema": { 137 | "$ref": "#/components/schemas/Pet" 138 | } 139 | }, 140 | "examples": [ 141 | { 142 | "name": "getPetExample", 143 | "description": "get pet example", 144 | "params": [ 145 | { 146 | "name": "petId", 147 | "value": 7 148 | } 149 | ], 150 | "result": { 151 | "name": "getPetExampleResult", 152 | "value": { 153 | "name": "fluffy", 154 | "tag": "poodle", 155 | "id": 7 156 | } 157 | } 158 | } 159 | ] 160 | } 161 | ], 162 | "components": { 163 | "contentDescriptors": { 164 | "PetId": { 165 | "name": "petId", 166 | "required": true, 167 | "description": "The id of the pet to retrieve", 168 | "schema": { 169 | "$ref": "#/components/schemas/PetId" 170 | } 171 | } 172 | }, 173 | "schemas": { 174 | "PetId": { 175 | "type": "integer", 176 | "minimum": 0 177 | }, 178 | "Pet": { 179 | "type": "object", 180 | "required": [ 181 | "id", 182 | "name" 183 | ], 184 | "properties": { 185 | "id": { 186 | "$ref": "#/components/schemas/PetId" 187 | }, 188 | "name": { 189 | "type": "string" 190 | }, 191 | "tag": { 192 | "type": "string" 193 | } 194 | } 195 | }, 196 | "Pets": { 197 | "type": "array", 198 | "items": { 199 | "$ref": "#/components/schemas/Pet" 200 | } 201 | } 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /service-descriptions/simple-math-openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "title": "Simple Math", 5 | "description": "A simple math example", 6 | "version": "1.0.0" 7 | }, 8 | "servers": [ 9 | { 10 | "name": "my simple math server", 11 | "summary": "simple math server summary", 12 | "description": "simple math server description", 13 | "url": "http://${username}.simple-math.example.org:${port}/${basePath}/", 14 | "variables": { 15 | "username": { 16 | "default": "demo", 17 | "description": "this is applied to the url as the subdomain" 18 | }, 19 | "port": { 20 | "default": "443", 21 | "enum": [ 22 | "8545", 23 | "443" 24 | ] 25 | }, 26 | "basePath": { 27 | "default": "jsonrpc" 28 | } 29 | } 30 | } 31 | ], 32 | "methods": [ 33 | { 34 | "name": "addition", 35 | "params": [ 36 | { "name": "a", "schema": { "$ref": "#/components/schemas/Integer" } }, 37 | { "name": "b", "schema": { "$ref": "#/components/schemas/Integer" } } 38 | ], 39 | "result": { "$ref": "#/components/contentDescriptors/c" }, 40 | "examples": [ 41 | { 42 | "name": "simpleMathAdditionTwo", 43 | "params": [ 44 | { "$ref": "#/components/examples/integerTwo" }, 45 | { "$ref": "#/components/examples/integerTwo" } 46 | ], 47 | "result": { "$ref": "#/components/examples/integerFour" } 48 | }, 49 | { 50 | "name": "simpleMathAdditionFour", 51 | "params": [ 52 | { "$ref": "#/components/examples/integerFour" }, 53 | { "$ref": "#/components/examples/integerFour" } 54 | ], 55 | "result": { "$ref": "#/components/examples/integerEight" } 56 | } 57 | ], 58 | "links": [ 59 | { 60 | "name": "subtractionLink", 61 | "description": "use the parameters from addition for subtraction", 62 | "method": "subtraction", 63 | "params": { 64 | "a": "$params.a", 65 | "b": "$params.b" 66 | } 67 | } 68 | ] 69 | }, 70 | { 71 | "name": "subtraction", 72 | "params": [ 73 | { "name": "a", "schema": { "$ref": "#/components/schemas/Integer" } }, 74 | { "name": "b", "schema": { "$ref": "#/components/schemas/Integer" } } 75 | ], 76 | "result": { "$ref": "#/components/contentDescriptors/c" }, 77 | "examples": [ 78 | { 79 | "name": "examplesSubtractFourTwo", 80 | "params": [ 81 | { "$ref": "#/components/examples/integerFour" }, 82 | { "$ref": "#/components/examples/integerTwo" } 83 | ], 84 | "result": { "$ref": "#/components/examples/integerTwo" } 85 | }, 86 | { 87 | "name": "examplesSubtractEightFour", 88 | "params": [ 89 | { "$ref": "#/components/examples/integerEight" }, 90 | { "$ref": "#/components/examples/integerFour" } 91 | ], 92 | "result": { "$ref": "#/components/examples/integerFour" } 93 | } 94 | ], 95 | "links": [ 96 | { 97 | "name": "additionLink", 98 | "description": "use the parameters from subtraction for addition", 99 | "method": "addition", 100 | "params": { 101 | "a": "$params.a", 102 | "b": "$params.b" 103 | } 104 | } 105 | ] 106 | } 107 | ], 108 | "components": { 109 | "contentDescriptors": { 110 | "c": { 111 | "name": "c", 112 | "schema": { 113 | "type": "integer" 114 | } 115 | } 116 | }, 117 | "schemas": { 118 | "Integer": { 119 | "type": "integer" 120 | } 121 | }, 122 | "examples": { 123 | "integerTwo": { 124 | "name": "two", 125 | "summary": "its a sample two", 126 | "description": "Im not sure how else to say two", 127 | "value": 2 128 | }, 129 | "integerFour": { 130 | "name": "four", 131 | "summary": "its a sample four", 132 | "description": "Im not sure how else to say four", 133 | "value": 4 134 | }, 135 | "integerEight": { 136 | "name": "eight", 137 | "summary": "its a sample eight", 138 | "description": "Im not sure how else to say eight", 139 | "value": 8 140 | } 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/index.test.ts: -------------------------------------------------------------------------------- 1 | import openRpcExamples from "./index"; 2 | 3 | import { dereferenceDocument } from "@open-rpc/schema-utils-js"; 4 | 5 | describe("meta-schema validates all examples without error", () => { 6 | it("has unique titles for each example", () => { 7 | const vals = Object.values(openRpcExamples); 8 | const uniqueTitles: any = {}; 9 | vals.map((v) => { uniqueTitles[v.info.title] = true; }); 10 | 11 | expect(Object.keys(uniqueTitles).length).toBe(vals.length); 12 | }); 13 | 14 | Object.entries(openRpcExamples).forEach(([name, example]) => { 15 | it(`validates the example: ${name}`, async () => { 16 | const result = await dereferenceDocument(example); 17 | expect(typeof result).toBe("object"); 18 | expect(result.methods.length).toBeGreaterThan(0); 19 | }); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import petstore from "../service-descriptions/petstore-openrpc.json"; 2 | import petstoreExpanded from "../service-descriptions/petstore-expanded-openrpc.json"; 3 | import petstoreByName from "../service-descriptions/params-by-name-petstore-openrpc.json"; 4 | import links from "../service-descriptions/link-example-openrpc.json"; 5 | import apiWithExamples from "../service-descriptions/api-with-examples-openrpc.json"; 6 | import simpleMath from "../service-descriptions/simple-math-openrpc.json"; 7 | import { OpenrpcDocument as OpenRPC } from "@open-rpc/meta-schema"; 8 | 9 | export interface Examples { 10 | [key: string]: OpenRPC; 11 | } 12 | 13 | const examples: Examples = { 14 | apiWithExamples: apiWithExamples as OpenRPC, 15 | links: links as OpenRPC, 16 | petstore: petstore as OpenRPC, 17 | petstoreByName: petstoreByName as OpenRPC, 18 | petstoreExpanded: petstoreExpanded as OpenRPC, 19 | simpleMath: simpleMath as OpenRPC, 20 | }; 21 | 22 | export default examples; 23 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "lib": [ 6 | "ES2015" 7 | ], 8 | "declaration": true, 9 | "outDir": "./build", 10 | "strict": true, 11 | "esModuleInterop": true, 12 | "resolveJsonModule": true, 13 | "esModuleInterop": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tsfmt.json: -------------------------------------------------------------------------------- 1 | { 2 | "baseIndentSize": 0, 3 | "indentSize": 2, 4 | "tabSize": 2, 5 | "indentStyle": 2, 6 | "newLineCharacter": "\r\n", 7 | "convertTabsToSpaces": true, 8 | "insertSpaceAfterCommaDelimiter": true, 9 | "insertSpaceAfterSemicolonInForStatements": true, 10 | "insertSpaceBeforeAndAfterBinaryOperators": true, 11 | "insertSpaceAfterConstructor": false, 12 | "insertSpaceAfterKeywordsInControlFlowStatements": true, 13 | "insertSpaceAfterFunctionKeywordForAnonymousFunctions": false, 14 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, 15 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, 16 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, 17 | "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, 18 | "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, 19 | "insertSpaceAfterTypeAssertion": false, 20 | "insertSpaceBeforeFunctionParenthesis": false, 21 | "insertSpaceBeforeTypeAnnotation": false, 22 | "placeOpenBraceOnNewLineForFunctions": false, 23 | "placeOpenBraceOnNewLineForControlBlocks": false 24 | } 25 | --------------------------------------------------------------------------------