Giter Site home page Giter Site logo

oxidecomputer-oxide.rs's Introduction

Oxide SDK and CLI

This repo contains the CLI, Rust SDK, and SDK mocking library. The CLI is released as binaries for various operating systens. The SDK and mocking library published to crates.io. All are derived from the Oxide API OpenAPI spec.

Generation

Generation of the CLI, SDK, and mocking library progenitor for code generation from the OpenAPI description of the Oxide API. Typically progenitor is used via a macro or build.rs, here we use an 'xtask`. Not only is the source OpenAPI document checked in, we also check-in the generated code 1. so that changes in generated output (in addition to input) may be easily tracked and 2. so that navigating from rustdoc to source shows the full code rather than, say, an opaque macro invocation (that yields literally tens of thousands of lines of code).

The Oxide OpenAPI description is in oxide.json. To re-generate the CLI and SDK from an updated API document, run cargo xtask generate. CI ensures that the API description and generated code are in sync.

Note
generation requires that a nightly version of rustfmt is installed.

Hand-written code

While both the SDK and CLI are mostly generated, both include some hand- written code as well.

The SDK includes hand-written code to simplify the use of some aspects of the API and to support the CLI. For example, it includes a clap-related impl block so that the ByteCount type can be specified with a binary suffix (e.g. 64gb).

The CLI includes hand-written code for some of the blocking and tackling. It also has hand-written code to add additional subcommands (e.g. auth) and to augment commands that cannot be fully or optimally generated.

Releasing a new version

There are several steps to releasing a new version.

Determine the version number

The CLI, SDK, and mocking library all carry the same version number which follows this pattern:

MAJOR.MINOR.PATCH+API_VERSION

The version number is incremented according to semver. This means that both API incompatibilities and generation incompatibilities need to be taken into account. The version of the API appears as, effectively, a comment suffix. This allows users to reasonably recognize the proper version for the version of the Oxide API currently deployed in their environment.

Update Cargo.toml files

Update Cargo.toml for the workspace, CLI, SDK, and mocking library. Commit changes.

Publish crates

Use cargo publish -p oxide and cargo publish -p oxide-httpmock.

Release the CLI

Tag the repo with the version number (vMAJOR.MINOR.PATCH+API_VERSION) and push change and tags. This will kick off the cargo-dist workflow to generate a release with binaries.

oxidecomputer-oxide.rs's People

Contributors

ahl avatar augustuswm avatar benjaminleonard avatar citrus-it avatar david-crespo avatar dependabot[bot] avatar faithanalog avatar felixmcfelix avatar github-actions[bot] avatar iliana avatar jgallagher avatar jmpesp avatar karencfv avatar labbott avatar lifning avatar luqmana avatar oxide-reflector-bot[bot] avatar rcgoodfellow avatar zephraph avatar

Watchers

 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.