Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some doc is out dated #4

Open
ailisp opened this issue Feb 27, 2017 · 9 comments
Open

Some doc is out dated #4

ailisp opened this issue Feb 27, 2017 · 9 comments

Comments

@ailisp
Copy link

ailisp commented Feb 27, 2017

I noticed the implement-resource-operation is now different as doc said. For example

(implement-resource-operation get-user (id &key expand)
   (serialize (find-user id) :expand expand))

should change to

(implement-resource-operation apt-test get-user (id &key expand)
   (serialize (find-user id) :expand expand))
@mmontone
Copy link
Owner

Yes. Sorry. I'll try to update the docs when I find time. The library has gone through some changes.

I was not aware there were users of the library, apart from me. :)

@mmontone
Copy link
Owner

I guess your best bet is to look at test code for now until I get to update the docs.

@ailisp
Copy link
Author

ailisp commented Feb 28, 2017 via email

@mmontone
Copy link
Owner

mmontone commented Feb 28, 2017 via email

@ailisp
Copy link
Author

ailisp commented Feb 28, 2017

For dispatching, are you mean this
And if when define api:

(define-api api-test
    (:title "Api test"
            :documentation "This is an api test")
  (parameters (:produces (:json)
                         :consumes (:json)
                         :documentation "Parameters test"
                         :path "/parameters")
              (parameters (:produces (:json)
                                     :consumes (:json)
                                     :documentation "Parameters test"
                                     :path "/parameters")
                          (&optional (boolean :boolean nil "A boolean parameter")
                                     (integer :integer nil "An integer parameter")
                                     (string :string nil "A string parameter")
                                     (list :list nil "A list parameter")))) ...)

If the inside parameters can derive options from the outside parameters that not provided it will be more convenient. Or we may use:

(define-api api-test
    (:title "Api test"
            :documentation "This is an api test")
  (parameters (:produces (:json)
                         :consumes (:json)
                         :documentation "Parameters test"
                         :path "/parameters")
              (:default
                          (&optional (boolean :boolean nil "A boolean parameter")
                                     (integer :integer nil "An integer parameter")
                                     (string :string nil "A string parameter")
                                     (list :list nil "A list parameter")))) ...)

to indicate the same. This only my personal preference, and not as important as XML serialization and dispatching. If you think these change (in define-api) is reasonable, I can send you a pull request ;)

@mmontone
Copy link
Owner

No, I mean this: https://github.com/mmontone/cl-rest-server/blob/master/src/api.lisp#L171

I'm not happy with that code.

Also, it doesn't implement this: https://raw.githubusercontent.com/webmachine/webmachine/develop/docs/http-headers-status-v3.png

Like other frameworks out there.

https://github.com/inhabitedtype/ocaml-webmachine

@ailisp
Copy link
Author

ailisp commented Feb 28, 2017

It's quite a lot error handling to do, wish cl-rest-server can be mature enough in the future

@mmontone
Copy link
Owner

The implementation technique for that is "parsing" that diagram in some way (you could have a declarative spec of that diagram) and generate the conditional code that does the dispatching. Sounds like fun.

@ailisp
Copy link
Author

ailisp commented Feb 28, 2017

Sounds like something I learned from Software Engineering course of auto generate Java program from UML. The program generated is 90% accurate, but that's enough. It's cool if you implement one for Common Lisp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants