Skip to content

A Rust crate to parse OpenRPC documents.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

deltachat/openrpc_type

Repository files navigation

Openrpc type

A crate to parse (maybe later also serialize) OpenRPC documents. OpenRPC is a specification for describing JsonRPC apis.

Uses

We made this to use as a base for a code generator that generates wrapper code in multiple languages. [not realized yet, this crate is the first step]

See https://github.com/open-rpc/typings if you need a code generator for types right now.

Places where this crate not follows the spec:

  • ServerObject.name attribute is currently optional, where in the spec it is required, because the official examples don't follow the spec here, see: open-rpc/examples#647

  • LinkObject.name attribute is currently optional, same reason as above, see open-rpc/examples#648

Todo

  • Make references work (OrRef type, currently it does not parse correctly)
  • Implement automated testing (smoke tests are sufficient for now)
    • add more examples (from openrpc)

Ideas

  • Maybe add some convenience function for resolving references? (only local ones remote ones will error for now I'd say)

Less Priority

  • ErrorObject.data (maybe serde_json::Value?)
  • LinkObject
  • ExampleObject

License

MIT or Apache, whatever suits you best. Most Documentation comments are under Apache License 2.0, because they were taken from https://spec.open-rpc.org/.

Testing Tips

run all tests, even if some fail:

cargo test --no-fail-fast

To test the parsing of a file you can run it through the "cli":

cargo run -- example_files/openrpc-examples/simple-math-openrpc.json > result

(pipe output to a file or to |less, because the file can be very long)

About

A Rust crate to parse OpenRPC documents.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages