Swagger #20
Replies: 7 comments 6 replies
-
Hi @magnusviri, According to my source, it could be Brad Becker or James Felton of Jamf we can ping about how Jamf uses swagger or suggestions for other route to go with swagger integration & usage. |
Beta Was this translation helpful? Give feedback.
-
I got the swagger file to work. I converted it to json and I can import that easily. I also updated the records.py file to use the swagger file. The reason I went down this rabbit hole was because I was hoping that instead of writing code that traverses the output of the Jamf API, I'm hoping we can write code that reads the swagger file and uses that to traverse the output of the Jamf API. We started this because we were trying to read policy scopes. I looked at all of the things that had scopes and we thought it was a generic thing, but it's not. Everything that has a scope has different parts, so scope isn't generic at all. They each used many similar things, but again, there were many different looking scopes. It will take longer to write code that reads the swagger file than to write code that deals with the policy scope, but if we do it right, using the swagger file will save us a ton of time and work will make finishing this project a possibility. |
Beta Was this translation helpful? Give feedback.
-
Ok, I'm not suppose to be working on this right now, but I just wanted to try something real quick. I had never heard of swagger before last week, but when I saw it, I had a hunch that it had some serious potential. Hearing that Kinobi used it as well made me want to look into it just a little bit more. So I did. And well... This site has a "generate client" menu item. I tried it and I got 15 MB worth of python code. I think this thing just wrote the entire python-jamf code we need... I'm sure we'll have to do a lot of work with it still, but we might be closer than we thought to finishing this whole thing (seems like we just barely started). My head is spinning a little... I don't really have time to check it out until Friday. But I'll include a zip if you guys want to look at it. |
Beta Was this translation helpful? Give feedback.
-
Hi @magnusviri & @Honestpuck: I found a contact at Jamf that provided this feedback about swagger specification...
In the /api/doc page of your instance you can see the I don’t have personal experience with that library and have not used to to create a client library myself. That being said your comment about the JSON being different is something I will investigate. What API endpoint was that model associated with? There are a lot of API endpoints with more each release. While a client library is very convenient to use, knowing where and how to read the documentation may be a more time-efficient procedure vs maintaining a library that is hand crafted. A lot of generated code does not follow common programming principals due to complexity of defining those relations and are not meant to be read or changed by humans. It’s an understood part of the trade off between writing code yourself and having the computer do it for you. |
Beta Was this translation helpful? Give feedback.
-
He said he is willing to setup a date/time to a video chat about it and the project if the group wants?
Let me know if there is interest.
|
Beta Was this translation helpful? Give feedback.
-
So I think this is what we kind of decided with a collective shrug. Most of this is based off of what we heard from the meeting with the Jamf developer. The new API can't do what we want, so we are have to use the Classic API whether we like it or not. However, the Classic API has problems, isn't really Swagger compliant, it's not going to be fixed, it's probably going to be deprecated, but that it wont happen for a long time. Jamf is putting their efforts into the new API, it should be Swagger compliant, but that it isn't ready yet and full of a lot of "preview" stuff. The only endpoints that can really be depended on in the new API start with /v1, /v2, etc. So, with all of this in mind, here is what we decided. We are going to stick with what we've done. The Swagger stuff was informative and we might even borrow some things from it. But we aren't going to switch to the CodeGen Client SDK (especially since it doesn't even work without tweaking). We also aren't going to flush out what we've done by deserializing all of the data from the server into Python objects. And we aren't going to try to make sure everything in records.py works. I'm going to create a new discussion listing our priorities. Also, I'm not sure I like the way Github's discussions are organized. It's hard to see what has had new replies. There's also several discussions about the same topic (e.g. swagger and records.py). I don't know if they can be merged. But anyway, I just thought I'd say that. It seems too easy for things to get buried and lost. |
Beta Was this translation helpful? Give feedback.
-
Ok, created the private channel and sent out invites to the group.
Thanks:
Richard Glaser (he/him/his)
University of Utah, Marriott Library ITS
richard.glaser@utah.edu<mailto:richard@scl.utah.edu>
On Feb 6, 2021, at 9:06 PM, Tony Williams <notifications@github.com<mailto:notifications@github.com>> wrote:
@magnusviri<https://github.com/magnusviri> I follow your logic.
I also agree about discussions. I missed this until I got an email. Perhaps a (closed?) channel on MacAdmins Slack would work better. #python-jamf-dev
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#20 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABPQEGSWUDUNIUIW3IFL2Q3S5YGV7ANCNFSM4WFBAQOQ>.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The Jamf Pro Swagger file is located here:
https://github.com/jamf/Classic-API-Swagger-Specification/blob/master/swagger.yaml
Loading
I used the following to convert it to json.
https://www.convertjson.com/yaml-to-json.htm
And I'm loading it that way. I couldn't see anything in that swagger parse module that does anything we want anyway. And it's one less requirement.
Using
So, it's kind of complex and I'm still trying to wrap my head around how to actually use it. So that's my next step.
Beta Was this translation helpful? Give feedback.
All reactions