Skip to content

Commit

Permalink
Merge b2871c4 into 49d242f
Browse files Browse the repository at this point in the history
  • Loading branch information
svetlyak40wt committed Nov 12, 2022
2 parents 49d242f + b2871c4 commit bad5180
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 97 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/client-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Grant All Perms to Make Cache Restoring Possible",
Expand All @@ -34,13 +34,13 @@
{
"name": "Get Current Month",
"id": "current-month",
"run": "echo \"::set-output name=value::$(date -u \"+%Y-%m\")\"",
"run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT",
"shell": "bash"
},
{
"name": "Cache Roswell Setup",
"id": "cache",
"uses": "actions/cache@v2",
"uses": "actions/cache@v3",
"with": {
"path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot",
"key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}"
Expand All @@ -56,8 +56,7 @@
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-client",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-client"
},
"if": "steps.cache.outputs.cache-hit != 'true'"
},
Expand All @@ -68,7 +67,7 @@
},
{
"name": "Update Qlot",
"run": "qlot update || qlot update",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
Expand All @@ -78,7 +77,7 @@
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-client\"",
"run": "qlot exec 40ants-linter --system \"openrpc-client\" --imports",
"shell": "bash"
}
]
Expand Down
50 changes: 45 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,47 @@
]
},
"jobs": {
"linter": {
"runs-on": "ubuntu-latest",
"env": {
"OS": "ubuntu-latest",
"QUICKLISP_DIST": "quicklisp",
"LISP": "sbcl-bin"
},
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-docs"
}
},
{
"name": "Change dist to Ultralisp",
"run": "echo 'dist ultralisp http://dist.ultralisp.org' > qlfile",
"shell": "bash"
},
{
"name": "Update Qlot",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
"name": "Install SBLint wrapper",
"run": "qlot exec ros install 40ants-linter",
"shell": "bash"
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-docs\" --imports",
"shell": "bash"
}
]
},
"build-docs": {
"runs-on": "ubuntu-latest",
"env": {
Expand All @@ -24,19 +65,18 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-docs",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-docs"
}
},
{
"name": "Build Docs",
"uses": "40ants/build-docs@v1.3.2-pre1",
"uses": "40ants/build-docs@v1",
"with": {
"asdf-system": "openrpc-docs",
"error-on-warnings": true
Expand All @@ -45,4 +85,4 @@
]
}
}
}
}
14 changes: 6 additions & 8 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-server",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-server"
}
},
{
Expand All @@ -41,7 +40,7 @@
},
{
"name": "Update Qlot",
"run": "qlot update || qlot update",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
Expand All @@ -51,7 +50,7 @@
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-server\"",
"run": "qlot exec 40ants-linter --system \"openrpc-server\" --imports",
"shell": "bash"
}
]
Expand All @@ -66,14 +65,13 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-server",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-server"
}
},
{
Expand Down
8 changes: 1 addition & 7 deletions client/ci.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
(in-package #:openrpc-client/ci)


(defparameter *asdf-version* "3.3.5.1"
"At some point installation of the latest roswell version was broken:
https://github.com/roswell/roswell/issues/497")


(defworkflow client-ci
:on-push-to "master"
:by-cron "0 10 * * 1"
:on-pull-request t
:cache t
:jobs ((40ants-ci/jobs/linter:linter
:asdf-version *asdf-version*)))
:jobs ((40ants-ci/jobs/linter:linter :check-imports t)))

22 changes: 11 additions & 11 deletions client/core.lisp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
(uiop:define-package #:openrpc-client/core
(:use #:cl)
(:import-from #:40ants-doc
#:defsection
#:defsection-copy)
(:import-from #:kebab
#:to-lisp-case)
(:import-from #:jsonrpc)
(:import-from #:log)
(:import-from #:yason)
(:import-from #:jsonrpc/class)
(:import-from #:str)
(:import-from #:dexador)
Expand All @@ -17,15 +15,10 @@
#:connection-refused-error)
(:import-from #:openrpc-client/error
#:rpc-error)
(:export #:@index
#:@readme
#:generate-client))
(:export #:generate-client))
(in-package #:openrpc-client/core)


(defsection @example (:title "Example chapter")
"Please, fill this documentation with real docs.")


(eval-when (:compile-toplevel :load-toplevel :execute)
(defun generate-method-description (spec)
Expand Down Expand Up @@ -283,10 +276,17 @@
:message message
:func-name func-name
:func-arguments arguments)))))
(jsonrpc:call client func-name arguments))))
(jsonrpc/class:call client func-name arguments))))


(defmacro generate-client (class-name url-or-path &key (export-symbols t))
"Generates Common Lisp client by OpenRPC spec.
CLASS-NAME is the name of a API class. Also, a corresponding MAKE-<CLASS-NAME> function
is created.
URL-OR-PATH argument could be a string with HTTP URL of a spec, or a pathname
if a spec should be read from the disc."
(let* ((spec (retrieve-spec (eval url-or-path)))
(client-class (generate-client-class class-name spec :export-symbols export-symbols))
(object-classes
Expand Down
8 changes: 6 additions & 2 deletions client/docs.lisp
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
(uiop:define-package #:openrpc-client/docs
(:use #:cl)
(:import-from #:40ants-doc
#:defsection))
#:defsection)
(:import-from #:openrpc-client
#:generate-client))
(in-package #:openrpc-client/docs)


(defsection @client (:title "Client")
(openrpc-client system)
"OPENRPC-CLIENT ASDF system provides a way to build CL classes and methods for working with JSON-RPC API.
All you need is to give it an URL and all code will be created in compile-time as a result of macro-expansion.
Expand Down Expand Up @@ -127,4 +130,5 @@ OPENRPC-EXAMPLE/CLIENT> (funcall #v167:1)
Now this is the last page and there is now a closure to retrieve the next page. Learn more how
to implement pagination on server-side in the OPENRPC-SERVER/DOCS::@PAGINATION section.
")
"
(generate-client macro))
7 changes: 6 additions & 1 deletion docs/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

(defchangelog (:ignore-words ("40ANTS-DOC"
"ASDF"
"API"
"CL"
"OSX"))
(0.4.0 2022-11-07
"- Fixed usage of default API when api is not specified to define-rpc-method macro.
- Fixed most imports.")
(0.3.0 2022-10-30
"- Method and its params now support such metadata as :summary :description and :deprecated.
- Schemas for CL classes can have :description if documentation id defined for class or its slots.
- Function OPENRPC-CLIENT:GENERATE now exports methods, classes and their slot readers by default.
- Macro OPENRPC-CLIENT:GENERATE-CLIENT now exports methods, classes and their slot readers by default.
- All methods, their arguments and object keys now use underscore instead of dash to make them more
convenient to use from other languages.")
(0.2.0 2022-10-25
Expand Down
9 changes: 2 additions & 7 deletions docs/ci.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@
(in-package #:openrpc-docs/ci)


(defparameter *asdf-version* "3.3.5.1"
"At some point installation of the latest roswell version was broken:
https://github.com/roswell/roswell/issues/497")


(defworkflow docs
:on-push-to "master"
:on-pull-request t
:by-cron "0 10 * * 1"
;; :cache t
:jobs ((40ants-ci/jobs/docs:build-docs
:asdf-version *asdf-version*)))
:jobs ((40ants-ci/jobs/linter:linter :check-imports t)
(40ants-ci/jobs/docs:build-docs)))
2 changes: 2 additions & 0 deletions docs/index.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"URL"
"CL"
"REPL"
"MAKE"
"HTTP"
"OPENRPC-CLIENT"
"ASDF"))
"
Expand Down
1 change: 1 addition & 0 deletions example/client.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(uiop:define-package #:openrpc-example/client
(:use #:cl)
(:import-from #:jsonrpc)
(:import-from #:openrpc-client
#:generate-client))
(in-package #:openrpc-example/client)
Expand Down
1 change: 0 additions & 1 deletion example/server.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#:return-error
#:transform-result
#:type-to-schema)
(:import-from #:clack.handler.hunchentoot)
(:import-from #:serapeum
#:dict)
(:import-from #:openrpc-server/clack
Expand Down
1 change: 1 addition & 0 deletions openrpc-client.asd
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
:source-control (:git "https://github.com/40ants/openrpc")
:in-order-to ((test-op (test-op openrpc-tests))))

(register-system-packages "log4cl" '(#:log))
5 changes: 2 additions & 3 deletions openrpc-example.asd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
:class :40ants-asdf-system
:defsystem-depends-on ("40ants-asdf-system")
:pathname "example"
:depends-on ("openrpc-example/server"
:depends-on ("clack-handler-hunchentoot"
"openrpc-example/server"
"openrpc-example/client")
:description "Example JSON-RPC server and client."
:homepage "https://40ants.com/openrpc/"
:source-control (:git "https://github.com/40ants/openrpc")
:in-order-to ((test-op (test-op openrpc-tests))))

(register-system-packages "clack-handler-hunchentoot" '(#:clack.handler.hunchentoot))
4 changes: 3 additions & 1 deletion openrpc-server.asd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
:class :40ants-asdf-system
:defsystem-depends-on ("40ants-asdf-system")
:pathname "server"
:depends-on ("openrpc-server/server")
:depends-on ("openrpc-server/server"
"openrpc-server/class"
"openrpc-server/discovery")
:description "OpenRPC server implementation for Common Lisp."
:homepage "https://40ants.com/openrpc/"
:source-control (:git "https://github.com/40ants/openrpc")
Expand Down
6 changes: 3 additions & 3 deletions qlfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
("quicklisp" .
(:class qlot/source/dist:source-dist
:initargs (:distribution "http://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest)
:version "2022-07-08"))
:version "2022-11-07"))
("ultralisp" .
(:class qlot/source/dist:source-dist
:initargs (:distribution "http://dist.ultralisp.org" :%version :latest)
:version "20221026155000"))
:version "20221112192001"))
("bordeaux-threads" .
(:class qlot/source/github:source-github
:initargs (:repos "svetlyak40wt/bordeaux-threads" :ref nil :branch "fix-apiv2-for-no-threads" :tag nil)
:version "github-29a839d1db25d86b18c0caad50036da9481b064b"))
("jsonrpc" .
(:class qlot/source/github:source-github
:initargs (:repos "svetlyak40wt/jsonrpc" :ref nil :branch "separate-clack-builder" :tag nil)
:version "github-62be10e477bb9ad2047e1c06afeb70aed2dcbd99"))
:version "github-12bc0abfa33497fff0b9974f7c23b7df25b6a979"))

0 comments on commit bad5180

Please sign in to comment.