mmontone / cl-rest-server

Serve REST APIs from Common Lisp
http://mmontone.github.io/cl-rest-server/cl-rest-server/
MIT License
66 stars 9 forks source link

rs.openapi:define-api-by-spec example? #7

Closed atgreen closed 4 years ago

atgreen commented 4 years ago

The define-api-by-spec example appears to be out of date. Can you provide another example, or perhaps some documentation? I'm guessing at arguments right now.

I'm trying to read the kubernetes swagger.json file and am getting errors like:

; Argument NAME not declared in #<RESOURCE-OPERATION WATCH-CORE-V1PERSISTENT-VOLUME GET "/api/v1/watch/persistentvolumes/{name}" {5057EEDB}>

Thanks!

mmontone commented 4 years ago

Hello.

This is how I'm using it in one of my projects:

(rs.openapi:define-api-from-spec invoice-engine-api (rs:api-docs-mixin)
  ()
  #.(asdf:system-relative-pathname :invoice-engine "api/api.json"))

api/api.json contains openapi spec of the api in json format.

Let me know if you still have problems.

Perhaps if you can attach some example of your api that is not working, I can have a look. There may be parts not supported/implemented.

mmontone commented 4 years ago

Ah. You are trying to read this: ? https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json

Is that version 3?

I've only implemented OpenApi version 3 specs so far.

atgreen commented 4 years ago

Yes, that's the file. Ah.. it's an older spec.... swagger 2.0. I suppose this won't work then?

mmontone commented 4 years ago

No. There's probably some conversion tool from swagger to openapi version 3. But don't know what the chances are that the oa v3 loads from restserver. I've only worked with simple apis so far.

El 15 de abril de 2020 23:04:43 GMT-03:00, Anthony Green notifications@github.com escribió:

Yes, that's the file. Ah.. it's an older spec.... swagger 2.0. I suppose this won't work then?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/mmontone/cl-rest-server/issues/7#issuecomment-614371605

-- Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.