man(1)

πŸ“¦
version 0.7.0 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… jsonrpcstub β€” NAME πŸ’…

okay so bestie, welcome to man(1), section 1 of the manual, and today's main character is jsonrpcstub β€” the lil tool that generates stubs for the libjson-rpc-cpp framework. yes, the original spelled it "genearate", we're not doing that, but the vibe stands ✨


πŸ¦‹ jsonrpcstub β€” SYNOPSIS πŸ¦‹

jsonrpcstub specfile.json [--cpp-server=namespace::ClassName]
 [--cpp-server-file=classqname.h]  [--cpp-client=namespace::ClassName]
[--cpp-client-file=classname.h] [--js-client=ClassName] [--js-client-
file=classname.js]  [-h] [-v] [--version]

that's the whole shape of it, no cap πŸ‘‘


🌸 jsonrpcstub β€” DESCRIPTION 🌸

so basically jsonrpcstub is the tool that takes a procedure specification file and turns it into C++ and JavaScript classes. that's it, that's the job. it's giving codegen fairy 🧚

✨ SPECIFICATION SYNTAX ✨

the spec file is a JSON file, and it holds all the available JSON-RPC methods and notifications, each with their own parameters and return values, all chillin' inside one top-level JSON array. like this:

[
     {
          "name": "method_with_positional_params",
          "params": [3,4],
          "returns": 7
     },
     {
          "name": "method_with_named_params",
          "params": {"param1": 3, "param2": 4},
          "returns": 7
     },
     {
          "name": "notification_without_parmas"
     }
]

the literal you drop inside each "params" and "returns" section is literally what defines the corresponding type. and here's the tea πŸ“ β€” if "params" contains an array, the parameters get accepted by position. if it contains an object, they get accepted by name. that's the whole distinction, periodt.


πŸŽ€ jsonrpcstub β€” OPTIONS πŸŽ€

  • -h β€” prints usage information. your classic "help meeee" flag πŸ™ˆ
  • -v β€” prints verbose information while the generation is happening. so you can watch it cook πŸ”₯
  • --version β€” prints version info and then exits. bye πŸ‘‹
  • --cpp-server=ClassName β€” creates an Abstract Server class. you can pass namespaces using the :: notation (e.g. ns1::ns2::Classname).
  • --cpp-server-file=filename.h β€” sets the filename to use when generating the C++ Abstract Server class. if you don't provide it, the lowercase classname gets used instead. defaults are so chill πŸ’œ
  • --cpp-client=ClassName β€” creates a C++ client class. namespaces are allowed here too, via the :: notation (e.g. ns1::ns2::Classname).
  • --cpp-client-file=filename.h β€” sets the filename to use when generating the C++ client class. no filename given? lowercase classname it is ✨
  • --js-client=ClassName β€” creates a JavaScript client class. no namespaces supported in this one, bestie, don't try it πŸ’€
  • --js-client-file=filename.js β€” sets the filename to use when generating the JavaScript client class.

🌈 jsonrpcstub β€” EXAMPLES 🌈

generate C++ stubs for a Server and a Client, and the classes will be named AbstractStubServer and StubClient:

jsonrpcstub  spec.json --cpp-server=AbstractStubServer
--cpp-client=StubClient

generate a JavaScript Client class MyRpcClient into the file someclient.js:

jsonrpcstub  spec.json --js-client=MyRpcClient
--js-client-file=someclient.js

look at that, iconic behaviour πŸ‘‘


⭐ jsonrpcstub β€” EXIT STATUS ⭐

this command returns 0 if no error occurred. in any other case, it returns 1. so 0 is the slay, 1 is the not-slay 😭


πŸ’œ jsonrpcstub β€” SEE ALSO πŸ’œ

go look, iykyk 🫢


πŸ’€ jsonrpcstub β€” BUGS πŸ’€

no known bugs. if you do find one, please report it as an issue on github, or just send an email. we're nice about it, fr fr 🌸


Copyright (C) 2011-2015 Peter Spiess-Knafl

and now the legal bit, verbatim, because we do not mess with license text bestie:

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

πŸ¦‹ jsonrpcstub β€” AUTHOR πŸ¦‹

Peter Spiess-Knafl (dev@spiessknafl.at)


and that's the page, bestie πŸ’– this was version 0.7.0, dated 7 April 2015, living its best life in man(1). obsessed with her honestly, bye πŸŽ€βœ¨